Is there a way to get a weight into the
pairwise_distances(X, metric='cosine')
Potentially using **kwrds
?
from sklearn.metrics import pairwise_distances
In the scipy cosine distance it's possible to add in an array for weights, but that doesn't give a pairwise matrix.
a = np.array([9,8,7,5,2,9])
b = np.array([9,8,7,5,2,2])
w = np.array([1,1,1,1,1,1])
distance.cosine(a,b,w)
Where w
is the weights.