yzhao062/pyod

knn metric cosine ValueError: Unrecognized metric 'cosine'

Open

#221 aperta il 19 ago 2020

Vedi su GitHub
 (3 commenti) (0 reazioni) (1 assegnatario)Python (1308 fork)batch import
bughelp wanted

Metriche repository

Star
 (7762 star)
Metriche merge PR
 (Merge medio 4g 17h) (14 PR mergiate in 30 g)

Descrizione

clf = KNN(metric="cosine")
clf.fit(train_data)

results in

sklearn/neighbors/_binary_tree.pxi in sklearn.neighbors._ball_tree.BinaryTree.__init__()

sklearn/neighbors/_dist_metrics.pyx in sklearn.neighbors._dist_metrics.DistanceMetric.get_metric()

ValueError: Unrecognized metric 'cosine'

Also brute and kd_tree don't support cosine, meaning that cosine is not supported by any algorithm.

Guida contributor