Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
k-meansクラスタリングの仕組み
Search
K_DM
December 30, 2021
Education
310
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
k-meansクラスタリングの仕組み
K_DM
December 30, 2021
More Decks by K_DM
See All by K_DM
主成分分析(PCA)の仕組み
k_study
0
230
X-meansの仕組み
k_study
0
2.3k
勾配ブースティングの仕組み
k_study
0
150
決定木を使った回帰の仕組み
k_study
0
260
アンサンブル学習① ランダムフォレストの仕組み
k_study
0
130
決定木に含まれるパラメタによる事前剪定と事後剪定
k_study
0
790
線形回帰② 正則化と過学習
k_study
0
650
外れ値とHuber(フーバー)損失
k_study
0
1.3k
木構造1~決定木の仕組み(分類)
k_study
0
200
Other Decks in Education
See All in Education
Sekolah Sabat - Triwulan 4 2026 - Pelajaran 6
hiola
0
9k
Biologicals & Herbals, and Food & Nutraceuticals
drpoonamkc
0
110
Pharmacognosy_Chapter_-1.pdf , Definition, history & scope of pharmacognosy
ak679839
0
180
1002
cbtlibrary
0
500
GENERAL PHARMACOLOGY
pawan_pharm
0
240
EL GEOPARQUE MUNDIAL UNESCO VOLCANES DE CALATRAVA: DE LA INVESTIGACIÓN CIENTÍFICA A LA TRANSPOSICIÓN DIDÁCTICA EN EL AULA
juanmartin2026
0
58k
[2026後期火5] 論理学(京都大学文学部 後期 第2回)「量化子の導入」
yatabe
0
240
Liburd and Stoll Farrell "Copyright Essentials From A to AI: A 2026 NISO Training Series, Session Two: Fair Use and the Public Domain"
baltimoreniso
0
140
Sekolah Sabat - Triwulan 4 2026 - Pelajaran 1
hiola
0
13k
生成AIとの付き合い方/ How to work with AI
kaityo256
PRO
3
1k
Introduction - Lecture 1 - Web Technologies (1019888BNR)
signer
PRO
0
6.6k
Liburd and Stoll Farrell "Copyright Essentials From A to AI: A 2026 NISO Training Series, Session Five: Open Movements & Author Rights"
baltimoreniso
0
130
Featured
See All Featured
YesSQL, Process and Tooling at Scale
rocio
174
15k
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
Paper Plane
katiecoart
PRO
6
55k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
350
Designing Powerful Visuals for Engaging Learning
tmiket
1
650
エンジニアに許された特別な時間の終わり
watany
109
250k
Optimising Largest Contentful Paint
csswizardry
37
4k
HDC tutorial
michielstock
2
1k
Documentation Writing (for coders)
carmenintech
77
5.6k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
800
Transcript
クラスタリング1 クラスタリング1 k-means k-means 作成者:K (リンク)
『クラスタリング』で説明する項目 k-means k-means++ X-means Part1 Part2
今回の内容 •クラスタリングとは •k-means •実験 •k-means++ •まとめ クラスタリングとk-meansアルゴリズムについて説明します
クラスタリング データを教師データ無しでいくつかのグループにまとめ上げる方法 データ は与えられている が、正解データ は無い =教師なし学習 X y
アルゴリズム データを用意します 2つのグループに分けること ができそうなので、 と 設定します k = 2
アルゴリズム 各クラスタの初期値を設定します 2つの初期値を作成します (作成の仕方は色々考えられますが、ここ ではデータのある空間の中に▪と▪を作 成してそれを初期値としました) ࢀߟจݙɿk-means clustering ͷॳظͷܾΊํΛݩʹͯ͠આ໌͍ͯ͠·͢
アルゴリズム クラスタの初期値に近い点を求め、それらをまとめます それぞれの初期値と距離が近 い点を赤と青で色付けします
アルゴリズム クラスタごとの平均値(セントロイド)を求めます 色付けした点の平均値を求めて、 それをクラスタを代表する点(セ ントロイド, centroid)とします
アルゴリズム セントロイドから近い点を再び求め、クラスタを割り当てます セントロイドから距離が近い点を 色付けします
アルゴリズム 再びセントロイドを再計算し、また同じことを繰り返します 色付けした点の平均値を求めて、 それをクラスタを代表する点(セ ントロイド, centroid)とします
アルゴリズム セントロイドが移動しなくなったら、計算を終了します! この「セントロイドを求める↔色 付けし直す」の作業を繰り返し、 セントロイドが移動量が十分小さ くなったら計算を終了します
実験!
K-meansクラスタリング ←のデータにk=2としてk-means を適用すると、綺麗にデータがク ラスタリングされる 色=クラスタ
クラスタの境界が明確でない場合 kの指定が適切でないと、一つの クラスタを複数の部分に分けてし まう場合がある
clusters(k)パラメタの影響 kの指定が適切でないと、一つの クラスタを複数の部分に分けてし まう場合がある
k-meansの問題 仮に初期値として隣接する点を選んでしまうと 収束するまでに時間がかかる可能性がある 初期値次第で計算終了に時間がかかる+結果が変わるかもしれない ▼収束後の結果
k-means++<> はじめに、ランダムに点を一つ選ぶ 次の点は、はじめに選んだ点との距離 に基づいた確率分布に基づいて選ぶ (遠いほど選ばれやすくなる) ※scikit-learnはデフォルトではk-means++が実行されます 参考文献:sklearn.cluster.KMeans 『k-meansの初期値はなるべく離れた点を選んだほうが良い』というアイデアを利用 [1] Arthur,
David, and Sergei Vassilvitskii. k-means++: The advantages of careful seeding. Stanford, 2006.
randomとk-mans++の比較 •K-means++はすべて同じような クラスタリングをすることができ ている •K-mansは初期値次第でクラスタ の境界が変化していることが確 認できる
まとめ K-meanアルゴリズムについて説明しました •クラスタリングとは、データを教師データ無しでいくつかのグループにまとめ上げる 方法 •K-meansでは、セントロイドの計算とクラスタの割り当てを繰り返すことでクラスタ のまとまりを求める •K-meansは初期値の決め方によって結果が変わったり収束するまでに時間がかかる 可能性があり、k-means++では改良を加えてこの問題を軽減している •パラメタkの設定次第では不自然な形のクラスタができることもある
参考文献 •https://ja.wikipedia.org/wiki/K%E5%B9%B3%E5%9D%87%E6%B3%95 •sklearn.cluster.KMeans •Arthur, David, and Sergei Vassilvitskii. k-means++: The
advantages of careful seeding. Stanford, 2006.