Created
June 21, 2013 14:08
-
-
Save yamaguchiyuto/5831409 to your computer and use it in GitHub Desktop.
DBSCAN with scikit-learn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
from scipy.spatial import distance | |
from sklearn.cluster import DBSCAN | |
S = numpy.array([[0,0.9],[0.1,0.8],[0.9,0.1],[0.85,0.05],[0.9,0.05],[0.05,0.85],[0.5,0.4]]) | |
dbs = DBSCAN(eps=0.2, min_samples=3) | |
dbs.fit(S) | |
dbs.labels_ # => array([ 1., 1., 0., 0., 0., 1., -1.]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment