OPSTIC 클러스터링 알고리즘

from sklearn.cluster import OPTICS,cluster_optics_dbscan
from sklearn.datasets import make_blobs
import numpy as np
import matplotlib.pyplot as plt
x,y = make_blobs(n_samples=500,n_features=4)
clust = OPTICS(min_samples=50,max_eps=np. inf,cluster_method='dbscan',eps=4.5,xi=.05,min_cluster_size=0.05)
np_data = np.array(x)
data = clust.fit(np_data)
print(x)
# print(clust.ordering_)
도달 가능성 = data.reachability_[clust.ordering_]
print(reachablity)
plt.subplot(2,2,1)
plt.plot(list(range(1,501)),reachablity,marker='.',markeredgewidth=3,linestyle='- ')
인쇄(data.labels_)
plt.subplot(2,2,2)
plt.scatter(np_data[:,0],np_data[:,1],c=data.labels_+1.5,linewidths=np.power(clust.labels_+1.5,2))
plt.show()

Supongo que te gusta

Origin blog.csdn.net/weixin_51395932/article/details/129925740
Recomendado
Clasificación