Skip to Content
Pythonデータサイエンスハンドブック ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習
book

Pythonデータサイエンスハンドブック ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習

by Jake VanderPlas, 菊池 彰
May 2018
Intermediate to advanced
556 pages
13h 21m
Japanese
O'Reilly Japan, Inc.
Content preview from Pythonデータサイエンスハンドブック ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習
5.12
 詳細:ガウス混合モデル
481
モデルという
k
平均法とは異なるクラスタリングモデルの必須要素です。
5.12.2
E-M
の一般化:ガウス混合モデル
ガウス混合モデル
GMM
Gaussian Mixture Models
)は、入力データセットを最もよくモデル
化する多次元のガウス確率分布の重ね合わせを見つけます。最も単純なケースでは、
GMM
k
均法と同じ方法でクラスタを見つけます( 5-127)。
In[7]: from sklearn.mixture import GaussianMixture
gmm = GaussianMixture(n_components=4).fit(X)
labels = gmm.predict(X)
plt.scatter(X[:, 0], X[:, 1], c=labels, s=40, cmap='viridis');
図5-127 データのガウス混合モデルによるラベル付け
GMM
には確率モデルが含まれているため、確率的なクラスタ割り当ても行えます。
scikit-learn
では
predict_proba
メソッドを使用します。これは、サイズ
[n
サンプル
, n
クラスタ
]
の行列を返し、
それぞれの点が各クラスタに属する確率を表します。
In[8]: probs = gmm.predict_proba(X)
print(probs[:5].round(3))
[[ 0. 0. 0.475 0.525]
[ 0. 1. 0. 0. ]
[ 0. 1. 0. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Pythonデータサイエンスハンドブック 第2版 ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習

Pythonデータサイエンスハンドブック 第2版 ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習

Jake VanderPlas, 菊池 彰
初めてのGraphQL ―Webサービスを作って学ぶ新世代API

初めてのGraphQL ―Webサービスを作って学ぶ新世代API

Eve Porcello, Alex Banks, 尾崎 沙耶, あんどうやすし

Publisher Resources

ISBN: 9784873118413Other