I want to see if I can modify the weight of the metric in KNeighborsClassifier. The L2 Euclidean metric works like this :
x = np.array([1,2,3])
y = np.array([6,5,4])
def d(x,y)=
sqrt((x[0]-y[0])^2 + (x[1]-y[1])^2 + (x[2]-y[2])^2)
But what if I want to add weighting, say [1,2,3]
to the L2 metric? For example,
w = np.array([1,2,3])
def d2(x,y)=
sqrt(w[0]*(x[0]-y[0])^2 + w[1]*(x[1]-y[1])^2 + w[2]*(x[2]-y[2])^2)
Is there anything I can do with the metric or metric_params in
KNeighborsClassifier(n_neighbors=5, weights='uniform', p=2, metric='minkowski', metric_params=None, **kwargs)
Thanks