DBSCAN error with cosine metric in python

后端 未结 2 1649
梦毁少年i
梦毁少年i 2021-01-18 08:50

I was trying to use DBSCAN algorithm from scikit-learn library with cosine metric but was stuck with the error. The line of code is

db = DBSCAN(eps=1, min_s         


        
2条回答
  •  情话喂你
    2021-01-18 09:12

    The indexes in sklearn (probably - this may change with new versions) cannot accelerate cosine.

    Try algorithm='brute'.

    For a list of metrics that your version of sklearn can accelerate, see the supported metrics of the ball tree:

    from sklearn.neighbors.ball_tree import BallTree
    print(BallTree.valid_metrics)
    

提交回复
热议问题