I am trying to broadcast the difference between two vectors. This works for a simple case like this:
In[1] : data = np.array([1,2])
In[2] : centers = np.array([[2,2],[3,3]])
In[3] : data - center
Out[3] : array([[-1, 0],
[-2, -1]])
But when I try to do the same thing but with larger dimension this won't work
In [4]: data = np.array([[1,2],[3,4],[6,7]])
In [5]: data
Out [5]: array([[1,2],
[3,4],
[6,7]])
In [6]: centers = np.array([[2,2],[3,3]])
In [7]: centers
Out [7]: array([[2,2],
[3,3]])
And I want to perform data - centers
so I can get as output:
array([[[-1,0],
[-2,-1]],
[[1,2],
[0,1]],
[[4,5],
[3,4]]]