29
いちばん簡単な クラスタリング ~レッツゴーデベロッパー2011 ~ 真幡康徳 - @mahata

Let's Go Developer 2011 - Clustering

Embed Size (px)

Citation preview

Page 1: Let's Go Developer 2011 - Clustering

いちばん簡単なクラスタリング~レッツゴーデベロッパー2011~

真幡康徳 - @mahata

Page 2: Let's Go Developer 2011 - Clustering

アジェンダ●自己紹介●クラスタリングとは●にばんめに簡単なクラスタリング

●いちばん簡単なクラスタリング

Page 3: Let's Go Developer 2011 - Clustering

自己紹介

Page 4: Let's Go Developer 2011 - Clustering

真幡康徳 (@mahata)

2011年04月~: 仙台市民

Page 5: Let's Go Developer 2011 - Clustering

今までの仕事●ブログサービス●レコメンドエンジン●ウェブ検索●ウェブ広告配信●etc...

Page 6: Let's Go Developer 2011 - Clustering

クラスタリングとは

Page 7: Let's Go Developer 2011 - Clustering

クラスタリング=グルーピング

http://www.flickr.com/photos/tonyjcase/2411318874/

Page 8: Let's Go Developer 2011 - Clustering

にばんめに簡単なクラスタリング

Page 9: Let's Go Developer 2011 - Clustering

5分間クラスタリング

...正直5分でする話じゃない

Page 10: Let's Go Developer 2011 - Clustering

データセット例リバウンド力 シュート力

桜木 花道 (x1) 5 1

魚住 純 (x2) 4 2

神 宗一郎 (x3) 1 5

河田 雅史 (x4) 5 4

仙道 彰 (x5) 5 5

※ 実在の漫画・キャラクタとは一切関係ありません

Page 11: Let's Go Developer 2011 - Clustering

リバウンド力 シュート力x1 5 1

x2 4 2

x3 1 5

x4 5 4

x5 5 5

x1 x2 x3 x4 x5x1 0 2 32 9 16x2 2 0 18 5 10x3 32 18 0 16 16x4 9 5 16 0 1x5 16 10 16 1 0

非類似度行列

(x1[0] – x2[0])2

+(x1[1] - x2[1])2

x1とx2の非類似度(ユークリッド距離)

Page 12: Let's Go Developer 2011 - Clustering

リバウンド力 シュート力x1 5 1

x2 4 2

x3 1 5

x4 5 4

x5 5 5

x1 x2 x3 x4 x5x1 0 2 32 9 16x2 2 0 18 5 10x3 32 18 0 16 16x4 9 5 16 0 1x5 16 10 16 1 0

非類似度行列

(x1[0] – x2[0])2

+(x1[1] - x2[1])2

x1とx2の非類似度(ユークリッド距離)

Page 13: Let's Go Developer 2011 - Clustering

リバウンド力 シュート力x1 5 1

x2 4 2

x3 1 5

x4 5 4

x5 5 5

x1 x2 x3 x4 x5x1 0 2 32 9 16x2 2 0 18 5 10x3 32 18 0 16 16x4 9 5 16 0 1x5 16 10 16 1 0

非類似度行列

(x1[0] – x2[0])2

+(x1[1] - x2[1])2

x1とx2の非類似度(ユークリッド距離)

対称行列

Page 14: Let's Go Developer 2011 - Clustering

x1 x2 x3 x4 x5x1 0 2 32 9 16x2 2 0 18 5 10x3 32 18 0 16 16x4 9 5 16 0 1x5 16 10 16 1 0

非類似度行列

Page 15: Let's Go Developer 2011 - Clustering

x1 x2 x3 x4 x5x1 0 2 32 9 16x2 2 0 18 5 10x3 32 18 0 16 16x4 9 5 16 0 1x5 16 10 16 1 0

非類似度行列

最小

=> x4とx5を併合する(G6)

Page 16: Let's Go Developer 2011 - Clustering

x1 x2 x3 x4 x5x1 0 2 32 9 16x2 2 0 18 5 10x3 32 18 0 16 16x4 9 5 16 0 1x5 16 10 16 1 0

非類似度行列

x1 x2 x3 G6x1 0 2 32 9x2 2 0 18 5x3 32 18 0 16G6 12 7 16 0

G6の要素はx4とx5の平均を採用(群間平均法)

Page 17: Let's Go Developer 2011 - Clustering

x1 x2 x3 G6x1 0 2 32 9x2 2 0 18 5x3 32 18 0 16G6 12 7 16 0

非類似度行列

最小

=> x1とx2を併合する(G7)

Page 18: Let's Go Developer 2011 - Clustering

繰り返す(略)

Page 19: Let's Go Developer 2011 - Clustering

樹状図x1

x2

x3

x4

x5 G6

G7

G8

G9

クラスタリングの進行

Page 20: Let's Go Developer 2011 - Clustering

にばんめに簡単なクラスタリング

Page 21: Let's Go Developer 2011 - Clustering

いちばん簡単なクラスタリング

Page 22: Let's Go Developer 2011 - Clustering

ツールを使う

http://www.cs.waikato.ac.nz/ml/weka/

Page 23: Let's Go Developer 2011 - Clustering

いちばん簡単なクラスタリング

Page 24: Let's Go Developer 2011 - Clustering

まとめ

Page 25: Let's Go Developer 2011 - Clustering

●クラスタリングは怖くない

Page 26: Let's Go Developer 2011 - Clustering

●クラスタリングは怖くない●ナイーブな実装は簡単

Page 27: Let's Go Developer 2011 - Clustering

●クラスタリングは怖くない●ナイーブな実装は簡単●ツールを使えばもっと簡単

Page 28: Let's Go Developer 2011 - Clustering

参考図書●[1]データマイニングの基礎ISBN-10: 4274203484

●[2]スラムダンク 19巻ISBN-10: 4088716299

●[3]魁! 男塾 17巻ISBN-10: 4088524977

Page 29: Let's Go Developer 2011 - Clustering

おしまい