seguendo l'esempio Demo of DBSCAN clustering algorithm di Scikit Learning sto provando a memorizzare in un array la x, y di ogni classe di clusteringDBSCAN in scikit-learn di Python: salvare i punti di cluster in un array
import numpy as np
from sklearn.cluster import DBSCAN
from sklearn import metrics
from sklearn.datasets.samples_generator import make_blobs
from sklearn.preprocessing import StandardScaler
from pylab import *
# Generate sample data
centers = [[1, 1], [-1, -1], [1, -1]]
X, labels_true = make_blobs(n_samples=750, centers=centers, cluster_std=0.4, random_state=0)
X = StandardScaler().fit_transform(X)
xx, yy = zip(*X)
scatter(xx,yy)
show()
db = DBSCAN(eps=0.3, min_samples=10).fit(X)
core_samples = db.core_sample_indices_
labels = db.labels_
n_clusters_ = len(set(labels)) - (1 if -1 in labels else 0)
print n_clusters_
3
sto cercando di capire l'attuazione DBSCAN da scikit-learn, ma da questo punto io sono avere problemi. Il numero di cluster è 3 (n_clusters_) e desidero memorizzare x, y di ciascun cluster in una matrice
sì, questo è esattamente quello che stavo cercando –
Questa sarebbe una grande aggiunta ai documenti :) –