标签:label ctr class ati code uniq numpy from div
import numpy as np import matplotlib.pyplot as plt from sklearn.datasets.samples_generator import make_classification from mpl_toolkits.mplot3d import Axes3D fig = plt.figure() ax = Axes3D(fig) data,labels=make_classification(n_samples=1000,n_features=3,n_redundant=0,n_informative=2, random_state=1,n_clusters_per_class=2) unique_lables=set(labels) colors=plt.cm.Spectral(np.linspace(0,1,len(unique_lables))) for k,col in zip(unique_lables,colors): x_k=data[labels==k] ax.scatter3D(x_k[:,0],x_k[:,1],x_k[:, 2], c=col) # 开始绘制,x_k[:,0] 表示取第一维 plt.title(‘data by make_classification()‘) plt.show()
标签:label ctr class ati code uniq numpy from div
原文地址:https://www.cnblogs.com/callyblog/p/10083885.html