Xとlabels_trueの値がそれぞれ何なのかわからないです。
import numpy as np import pandas as pd from sklearn.datasets import make_blobs %matplotlib inline import matplotlib.pyplot as plt X, labels_true = make_blobs( n_samples=1000, centers=[[-5,-5],[0,0],[5,5]], cluster_std=1.0, random_state=0) print(X) print(labels_true) df = pd.DataFrame(np.hstack([X, labels_true.reshape(len(labels_true),1)]),columns=["X0","X1","label"]) col = df.label.map({0:'b', 1:'g', 2:'r'}) df.plot(x='X0', y='X1', kind='scatter', c=col, colorbar=False, figsize=(3,3))
というサンプルコードがあって、
print(X)では
[[-6.04855297 -6.42001794] [-3.23594765 -4.59984279] [ 4.50420451 6.21657771] ..., [ 0.60711167 -1.04817041] [ 1.63159743 0.37775917] [ 4.02759711 6.34622107]]
と出力されて、print(labels_true)では
[0 0 2 1 2 1 0 0 2 1 1 0 2 0 2 0・・・]
と出力されました。
一見するとone-hot encodingのようですが、何の次元を取っているのかわかりません。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2017/12/13 02:42
2017/12/13 04:51 編集
2017/12/13 05:03
2017/12/13 09:04