SlideShare une entreprise Scribd logo
1  sur  27
Télécharger pour lire hors ligne
機械学習勉強会 #3
9章 クラスタリング
10章 k近傍法を用いた推薦システム
@ketancho
アジェンダ
1. クラスタリングとは(9章)
2. k近傍法とは(10.1)
3. k近傍法を用いた推薦システムとは(10.2)
4. 私のやりたかった推薦について皆さんに逆質問するコーナー
1. クラスタリングとは(9章)
2. k近傍法とは(10.1)
3. k近傍法を用いた推薦システムとは(10.2)
4. 私のやりたかった推薦について皆さんに逆質問するコーナー
クラスタリング #とは
・ある集団における各メンバの類似度を知りたい
・ex. 「この人と女性の趣味があうかを知りたい」
クラスタリング #やってみた
S氏 普通 うーん まぁまぁ うーん うーん 好きや!
G氏 ふつー 好き! うーん。 ふつー ふつー 大好き!
・
・
K氏 うーん ふつー うーん うーん 大好き 好きや! 
(私)
クラスタリング #やってみた
S氏 0 -1 0 -1 0 1
G氏  0 1 -1 0 0 1
・
・
K氏 -1 0 -1 -1 1 1 
(私)
クラスタリング #やってみた
1. 評価を符号化(+1, 0, -1)して行列化する
クラスタリング #やってみた
2. 行列を作って転置したものと掛け合わせる
 ※(互いの同意の数ー非同意の数)になる
   →値が正なら同意見が多く、負なら反対意見が多い
クラスタリング #やってみた
3. 人ごとのn次元ユークリッド距離を求める(今回は n = 7)
クラスタリング #やってみた
4. 可視化してみる
1. クラスタリングとは(9章)
2. k近傍法とは(10.1)
3. k近傍法を用いた推薦システムとは(10.2)
4. 私のやりたかった推薦について皆さんに逆質問するコーナー
k近傍法 #とは
・単純な線形の決定線境界を引けないときもある
?
k近傍法 #とは
・k近傍法 => 入力に最も近いk個の点の多数決で予測を行う
k=3 の場合は○
(k=1 の場合は△)
?
k近傍法 10.1でやってること
100個の x, y, label(0 or 1) のデータがある
→各点ごとの x, y から k近傍法でlabelを予想し、予想と事実の差異を比較
k近傍法 10.1でやってること
1. 各点ごとの距離を表すテーブル(100x100)を作成する
2. 各点ごとに自分に近い点の順に並び替え、
 上位25個(k=25)の点のLabelで多数決を取る
3. 2. で行ったk近傍法の予測値を元テーブルに付与する
4. Label と 予測値の合致率を求める
 →このデータでは合致率93%
私のやりたかった
レコメンドとイメージが違う。。
(余談)私のやりたかったレコメンド #とは
友人A氏
「さしこが好きで、ゆきりんはあまりタイプじゃないんだけど、
 他に可愛いメンバ紹介してよ。」
私
「(Bもさしこ好きで、ゆきりんあんまりって言ってて、
  たしかあいつさや姉も好きって言ってたな。)
 山本彩っていう子がオススメだよ!
 あと松井玲奈ちゃんがめっちゃかわいい! 」
とか言っててもしょうがないので、10.2
を読んでみました。
1. クラスタリングとは(9章)
2. k近傍法とは(10.1)
3. k近傍法を用いた推薦システムとは(10.2)
4. 私のやりたかった推薦について皆さんに逆質問するコーナー
k近傍法 10.2でやってること
アイテムベースの方法を用いて、Rプログラマ50人が使用しているパッケージ情報を
元に、あるユーザが各パッケージをインストールしているかどうかを、そのユーザがイ
ンストールした他のパッケージの情報を用いて予測する。
ユーザ(50人)ごとにパッケージ(2,487件)を入れているか否かのデータ
k近傍法 10.2でやってること
1. 元データが縦長のデータになっているので、50 x 2,487 のテーブルに変換
2. 類似度の指標として、各列の相関係数テーブルを求める
 ※ 2,487 x 2,487 のテーブル(-1 ~ 1の実数が入っている)
ユーザ
パッケージ
k近傍法 10.2でやってること
3. k近傍法を使うために類似度(相関)を距離に変換する。
 類似度1を距離0、類似度-1を距離∞に変換する
4. k近傍を取得する関数を作る
k近傍法 10.2でやってること
5. 4. の関数を用い、各パッケージごとに25つの近傍パッケージ(★)を取得。
 各ユーザが★をインストールしているかを調べ、
  (★の中でインストールしているパッケージの総数)/25
 をそのパッケージをインストールしている確率にする
 ユーザ1はパッケージ1の★のうち19パッケージをインストール済なので、
 パッケージ1をインストールしている確率は 0.76 となる
 
k近傍法 10.2でやってること
6. 全てのパッケージについてインストールされている確率を計算し、
 確率をソートして、上位のパッケージを推薦する
やっぱり私のやりたいレコメンドとは
違った。既に分かっていることを推薦す
るのって意味ないんじゃ?
1. クラスタリングとは(9章)
2. k近傍法とは(10.1)
3. k近傍法を用いた推薦システムとは(10.2)
4. 私のやりたかった推薦について皆さんに逆質問するコーナー
・「協調フィルタリング」
 →他の人の嗜好を蓄積しておき、似ている人を見つけ、ユーザに推薦を行う
  
※まさに「さしこが好きで、ゆきりんが・・」の方法
・「内容ベースフィルタリング」
 →推薦の対象物(例えばAKBGのメンバ)の特徴から、ユーザに推薦を行う
※「黒髪の子がいい」とか「背が155cmより低い子がいい」とか?
私がやりたいレコメンド #やってみた
私がやりたいレコメンド #やってみた
・「アイテムベース」
 →蓄積したデータから「セットで好まれる数」を計算し、推薦する
※「さしことさや姉両方好きって言う人が多い」
 「この人さしこ好きらしい」
  →さや姉を紹介する?
・「ユーザベース」
 →好みの一致割合からユーザとの類似度を計算する
私がやりたいレコメンド #やってみた
私がやりたいレコメンド #やってみた
課題
 ・類似度の出し方ってこれでいいの?
 ・類似度が同じだったときに、推薦対象は多数決で決めていいの?
 ・精度を上げるには蓄積データを増やす必要があるけど、
  増やしすぎると処理時間かなり増えそう
 ・そもそも序盤のデータ蓄積どうするの?
  何件あればそれなりの精度になるの?
なにかと課題は多そうですが、スモールスタートでサービス作ってみます。

Contenu connexe

En vedette

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 

En vedette (20)

Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 

機械学習勉強会 #3