Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
みんなのPython勉強会#38登壇資料 tf-idfを使ったグロースハック
Search
sugaya takehiro
September 12, 2018
Technology
1
840
みんなのPython勉強会#38登壇資料 tf-idfを使ったグロースハック
sugaya takehiro
September 12, 2018
Tweet
Share
Other Decks in Technology
See All in Technology
音声×Copilot オンコパの世界
kasada
1
120
AWS Lambdaと歩んだ“サーバーレス”と今後 #lambda_10years
yoshidashingo
1
140
FOSS4G 2024 Japan コアデイ 一般発表25 PythonでPLATEAUのデータを手軽に扱ってみる
ra0kley
1
140
State of Open Source Web Mapping Libraries
dayjournal
0
240
これまでの計測・開発・デプロイ方法全部見せます! / Findy ISUCON 2024-11-14
tohutohu
3
340
なぜ今 AI Agent なのか _近藤憲児
kenjikondobai
3
1.2k
透過型SMTPプロキシによる送信メールの可観測性向上: Update Edition / Improved observability of outgoing emails with transparent smtp proxy: Update edition
linyows
2
200
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
300k
Platform Engineering for Software Developers and Architects
syntasso
1
460
Lambdaと地方とコミュニティ
miu_crescent
2
330
QAEチームが辿った3年 ボクらが改善業務にスクラムを選んだワケ / 20241108_cloudsign_ques23
bengo4com
0
1.3k
ドメインの本質を掴む / Get the essence of the domain
sinsoku
2
140
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
264
13k
The Cost Of JavaScript in 2023
addyosmani
45
6.7k
Navigating Team Friction
lara
183
14k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
We Have a Design System, Now What?
morganepeng
50
7.2k
For a Future-Friendly Web
brad_frost
175
9.4k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
43
2.2k
YesSQL, Process and Tooling at Scale
rocio
168
14k
Embracing the Ebb and Flow
colly
84
4.5k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Transcript
͍·͞Β͚ͩͲPythonͰtf-idfͬͯΈͨ UGJEGΛͬͯ ΞϓϦͷάϩʔεΛͯ͠Έͨ
ΤϯδχΞ σʔλΞφϦετ Ϗδωε ຊ͍Β͍ͯ͠Δํ
ࣗݾհ • Takehiro Sugara @sugartaker • ੲϦαʔνձࣾͰ ੳɾࣄۀ։ൃ͍ͯ͠·ͨ͠ • ࠓϔϧεέΞΞϓϦͷ
άϩʔεϋοΫΛ͍ͯ͠·͢
ಥવͰ͕͢ɺࢲ͋ΔࣈΛͱͯάϩʔεͤ͞·ͨ͠ ඪ
1 0 2 ࢲͷମॏͰ͢ దਖ਼ମॏ
ࠓ͢͜ͱ • ࣗݾհ • tf-idfΛͬͯΞϓϦͷάϩʔεΛͯ͠Έͨ
͜Μͳ͜ͱ͋Γ·ͤΜ͔ʁ • Ϛʔέ୲ऀ • ݁ہͲΜͳײ͡ͷࠂόφʔ͕͍͍ͷʁ • ηʔϧε୲ऀ • ݁ہͲΜͳײ͡ͷϝϧϚΨɾϓογϡ௨͕͍͍ͷʁ •
ϥΠλʔ • ݁ہͲΜͳײ͡ͷهࣄ͕͍͍ͷʁ
͜Μͳ͜ͱ͋Γ·ͤΜ͔ʁ ਖ਼Ϧιʔε͕Γͳͯ͘ࡉ͔͍ͱ͜Ζ·ͰΈͯΒΕͳ͍ʂ
'J/$Ͱ͋Γ·ͨ͠
ͦͦ'J/$ͬͯͲΜͳձࣾʁ
ʮ༧ϔϧεέΞºςΫϊϩδʔʯʹಛԽͨ͠ϔϧεςοΫϕϯνϟʔ l"CPVU'J/$z
ɹ FiNC͕ఏڙՄೳͳιϦϡʔγϣϯ 'J/$͕ఏڙ͍ͯ͠ΔαʔϏε FiNCΞϓϦ ʢToC͚ΞϓϦʣ FiNC for Business ʢToB͚αʔϏεʣ FiNC
Fit ʢύʔιφϧδϜʣ FiNC Mall ʢECαΠτʣ
ɹ FiNC͕ఏڙՄೳͳιϦϡʔγϣϯ 'J/$͕ఏڙ͍ͯ͠ΔαʔϏε FiNCΞϓϦ ʢToC͚ΞϓϦʣ FiNC for Business ʢToB͚αʔϏεʣ FiNC
Fit ʢύʔιφϧδϜʣ FiNC Mall ʢECαΠτʣ
ɹ FiNC͕ఏڙՄೳͳιϦϡʔγϣϯ 'J/$ΞϓϦ͕ఏڙ͍ͯ͠ΔαʔϏε ϝσΟΞ ϥΠϑϩά νϟοτϘοτ αϒεΫϦϓγϣϯ
ɹ FiNC͕ఏڙՄೳͳιϦϡʔγϣϯ 'J/$ΞϓϦ͕ఏڙ͍ͯ͠ΔαʔϏε ϝσΟΞ ϥΠϑϩά νϟοτϘοτ αϒεΫϦϓγϣϯ
ɹ FiNC͕ఏڙՄೳͳιϦϡʔγϣϯ 'J/$ΞϓϦ͕ఏڙ͍ͯ͠ΔαʔϏε ϝσΟΞ • 20181݄͔Βελʔτ • ϔϧεέΞؔ࿈ͷهࣄΛܝࡌ͍ͯ͠Δ
՝ ݁ہͲΜͳײ͡ͷهࣄ͕͍͍ͷʁ ϥΠλʔ
՝ • ݸʑͷίϯςϯπͷCTRɾ͓ؾʹೖΓɾࡏ࣌ؒΘ͔Δ • ͰશମతʹͲΜͳίϯςϯπ͕έΔͷ͔ײ֮తʹ͔͠Θ͔Βͳ͍
ղܾࡦ • ͲΜͳ୯ޠ͕ೖͬͨهࣄͩͱέ͍͢ͷ͔Λఆྔతʹग़͢
UGJEGΛͬͯΈͨ
UGJEGͱʁ • tf-idfͱʁ • Term Frequency Inverse Document Frequencyͷུ •
จষͷத͔ΒಛޠΛநग़͜ͱ͕Ͱ͖Δ • tf-idfΛ͏ཧ༝ • ʢݹయతͳख๏͚ͩͲʣ • ܭࢉ͍͢͠ • આ໌͍͢͠ • ͺͬͱग़ͤΔ
UGJEGͷϩδοΫ • tfɿରจষͷର୯ޠͷग़ݱճ ɹɹ/ ରจষͷશͯͷ୯ޠͷग़ݱճ ɹˠͦͷ୯ޠ͕ͦͷจষʹͲΕ͚ͩଟ͘ग़ݱ͍ͯ͠Δ͔ • idfɿlog(૯จষ / ର୯ޠ͕ग़ݱ͢Δจষʣ+
1 ɹɹˠͦͷ୯ޠ͕શମͷจষʹରͯ͠ͲΕ͚ͩϨΞ͔ • tf-idfɿtf * idf
45&1 ϩʔσʔλ ࡞ ܗଶૉղੳ tf-idfΛ ܭࢉ
ϩʔσʔλͷ࡞ จষ༰ จষ1 ࢲPythonͷຊΛಡΉ จষ2 ࢲຊ͕͖ͩ จষ3 ࢲPythonͷຊΛಡΈͳ͕Β PythonͷίʔυΛॻ͘
ܗଶૉղੳ จষ༰ จষ1 ࢲPythonͷຊΛಡΉ จষ2 ࢲຊ͕͖ͩ จষ3 ࢲPythonͷຊΛಡΈͳ͕Β PythonͷίʔυΛॻ͘
ܗଶૉղੳ จষ༰ จষ1 ࢲ Python ຊ จষ2 ࢲ ຊ จষ3
ࢲ Python ຊ Pythonίʔυ
UGJEGͷܭࢉ จষ༰ จষ1 ࢲ Python ຊ จষ2 ࢲ ຊ จষ3
ࢲ Python ຊ Python ίʔυ TF ࢲ 1/5 = 0.2 Python 2/5 = 0.4 ຊ 1/5 = 0.2 ίʔυ 1/5 = 0.2
UGJEGͷܭࢉ จষ༰ จষ1 ࢲ Python ຊ จষ2 ࢲ ຊ จষ3
ࢲ Python ຊ Python ίʔυ TF ࢲ 1/5 = 0.2 Python 2/5 = 0.4 ຊ 1/5 = 0.2 ίʔυ 1/5 = 0.2 ରจষͷର୯ޠͷग़ݱճ ɹɹ/ ରจষͷશͯͷ୯ޠͷग़ݱճ →ͦͷ୯ޠ͕ͦͷจষʹͲΕ͚ͩଟ͘ग़ݱ͍ͯ͠Δ͔
UGJEGͷܭࢉ จষ༰ จষ1 ࢲ Python ຊ จষ2 ࢲ ຊ จষ3
ࢲ Python ຊ Python ίʔυ TF IDF ࢲ 1/5 = 0.2 log2(3/3) + 1 = 1 Python 2/5 = 0.4 log2(3/2) + 1 = 1.58 ຊ 1/5 = 0.2 log2(3/3) + 1= 1 ίʔυ 1/5 = 0.2 log2(3/1) + 1= 2.58
UGJEGͷܭࢉ จষ༰ จষ1 ࢲ Python ຊ จষ2 ࢲ ຊ จষ3
ࢲ Python ຊ Python ίʔυ TF IDF ࢲ 1/5 = 0.2 log2(3/3) + 1 = 1 Python 2/5 = 0.4 log2(3/2) + 1 = 1.58 ຊ 1/5 = 0.2 log2(3/3) + 1= 1 ίʔυ 1/5 = 0.2 log2(3/1) + 1= 2.58 log(૯จষ / ର୯ޠ͕ग़ݱ͢Δจষʣ+ 1 →ͦͷ୯ޠ͕શମͷจষʹରͯ͠ͲΕ͚ͩϨΞ͔
UGJEGͷܭࢉ จষ༰ จষ1 ࢲ Python ຊ จষ2 ࢲ ຊ จষ3
ࢲ Python ຊ Python ίʔυ TF IDF TF-IDF ࢲ 1/5 = 0.2 log2(3/3) + 1 = 1 0.20 Python 2/5 = 0.4 log2(3/2) + 1 = 1.58 0.63 ຊ 1/5 = 0.2 log2(3/3) + 1= 1 0.20 ίʔυ 1/5 = 0.2 log2(3/1) + 1= 2.58 0.52
UGJEGͷܭࢉ จষ༰ จষ1 ࢲ Python ຊ จষ2 ࢲ ຊ จষ3
ࢲ Python ຊ Python ίʔυ TF IDF TF-IDF ࢲ 1/5 = 0.2 log2(3/3) + 1 = 1 0.20 Python 2/5 = 0.4 log2(3/2) + 1 = 1.58 0.63 ຊ 1/5 = 0.2 log2(3/3) + 1= 1 0.20 ίʔυ 1/5 = 0.2 log2(3/1) + 1= 2.58 0.52 TF * IDF
UGJEGͷܭࢉ จষ༰ จষ1 ࢲ Python ຊ จষ2 ࢲ ຊ จষ3
ࢲ Python ຊ Python ίʔυ TF IDF TF-IDF ࢲ 1/5 = 0.2 log2(3/3) + 1 = 1 0.20 Python 2/5 = 0.4 log2(3/2) + 1 = 1.58 0.63 ຊ 1/5 = 0.2 log2(3/3) + 1= 1 0.20 ίʔυ 1/5 = 0.2 log2(3/1) + 1= 2.58 0.52
UGJEGͷܭࢉ จষ༰ จষ1 ࢲ Python ຊ จষ2 ࢲ ຊ จষ3
ࢲ Python ຊ Python ίʔυ TF IDF TF-IDF ࢲ 1/5 = 0.2 log2(3/3) + 1 = 1 0.20 Python 2/5 = 0.4 log2(3/2) + 1 = 1.58 0.63 ຊ 1/5 = 0.2 log2(3/3) + 1= 1 0.20 ίʔυ 1/5 = 0.2 log2(3/1) + 1= 2.58 0.52 ͜ͷจষͰ Pythonͱ͍͏୯ޠ ͕ಛతʂ
UGJEGͷܭࢉ จষ༰ จষ1 ࢲ Python ຊ จষ2 ࢲ ຊ จষ3
ࢲ Python ຊ Python ίʔυ TF IDF TF-IDF ࢲ 1/5 = 0.2 log2(3/3) + 1 = 1 0.20 Python 2/5 = 0.4 log2(3/2) + 1 = 1.58 0.63 ຊ 1/5 = 0.2 log2(3/3) + 1= 1 0.20 ίʔυ 1/5 = 0.2 log2(3/1) + 1= 2.58 0.52 ͜ͷจষͰ Pythonͱ͍͏୯ޠ ͕ಛతʂ
՝ • ݸʑͷίϯςϯπͷCTRɾ͓ؾʹೖΓɾࡏ࣌ؒΘ͔Δ • ͰશମతʹͲΜͳίϯςϯπ͕ड͚Δͷ͔ײ֮తʹ͔͠Θ͔Βͳ͍
͔ͭͯ͜Μͳ͜ͱ͕͋Γ·ͨ͠ هࣄ༰ KPI هࣄ1 μΠΤοτʹӡಈ͕ॏཁ ྑ͍ هࣄ2 μΠΤοτదͳӡಈͱӫཆɺ ಛʹ࣭ͷ੍ݶ͕ޮՌత ྑ͍
هࣄ3 ࣭ΛμΠΤοτதʹ৯ͨ͘ͳͬͨΒʁ ѱ͍ هࣄ4 ӫཆΛؾʹͯ͠μΠΤοτɺ ӫཆ࣭όϥϯεΑ͘ઁऔ͠Α͏ ѱ͍
͔ͭͯ͜Μͳ͜ͱ͕͋Γ·ͨ͠ هࣄ༰ KPI هࣄ1 μΠΤοτʹӡಈ͕ॏཁ ྑ͍ هࣄ2 μΠΤοτదͳӡಈͱӫཆɺ ಛʹ࣭ͷ੍ݶ͕ޮՌత ྑ͍
هࣄ3 ࣭ΛμΠΤοτதʹ৯ͨ͘ͳͬͨΒʁ ѱ͍ هࣄ4 ӫཆΛؾʹͯ͠μΠΤοτɺ ӫཆ࣭όϥϯεΑ͘ઁऔ͠Α͏ ѱ͍
͔ͭͯ͜Μͳ͜ͱ͕͋Γ·ͨ͠ هࣄ༰ KPI هࣄ1 μΠΤοτʹӡಈ͕ॏཁ ྑ͍ هࣄ2 μΠΤοτదͳӡಈͱӫཆɺ ಛʹ࣭ͷ੍ݶ͕ޮՌత ྑ͍
هࣄ3 ࣭ΛμΠΤοτதʹ৯ͨ͘ͳͬͨΒʁ ѱ͍ هࣄ4 ӫཆΛؾʹͯ͠μΠΤοτɺ ӫཆ࣭όϥϯεΑ͘ઁऔ͠Α͏ ѱ͍ μΠΤοτهࣄ͕ ͍͍Μ͡Όͳ͍ʁ
͔ͭͯ͜Μͳ͜ͱ͕͋Γ·ͨ͠ هࣄ༰ KPI هࣄ1 μΠΤοτʹӡಈ͕ॏཁ ྑ͍ هࣄ2 μΠΤοτదͳӡಈͱӫཆɺ ಛʹ࣭ͷ੍ݶ͕ޮՌత ྑ͍
هࣄ3 ࣭ΛμΠΤοτதʹ৯ͨ͘ͳͬͨΒʁ ѱ͍ هࣄ4 ӫཆΛؾʹͯ͠μΠΤοτɺ ӫཆ࣭όϥϯεΑ͘ઁऔ͠Α͏ ѱ͍ ຊ μΠΤοτهࣄ ྑ͍ͷѱ͍ͷ ͋Δ
UGJEGͩͯ͠ΈΔ هࣄ༰ KPI هࣄ1 μΠΤοτʹӡಈ͕ॏཁ ྑ͍ هࣄ2 μΠΤοτదͳӡಈͱӫཆɺ ಛʹ࣭ͷ੍ݶ͕ޮՌత ྑ͍
هࣄ3 ࣭ΛμΠΤοτதʹ৯ͨ͘ͳͬͨΒʁ ѱ͍ هࣄ4 ӫཆΛؾʹͯ͠μΠΤοτɺ ӫཆ࣭όϥϯεΑ͘ઁऔ͠Α͏ ѱ͍
UGJEGͩͯ͠ΈΔ هࣄ༰ KPI هࣄ1 μΠΤοτ ӡಈ ྑ͍ هࣄ2 μΠΤοτ ӡಈ
ӫཆ ࣭ ྑ͍ هࣄ3 ࣭ μΠΤοτ ѱ͍ هࣄ4 ӫཆ μΠΤοτ ӫཆ ࣭ ѱ͍
UGJEGͩͯ͠ΈΔ هࣄ༰ KPI هࣄ1 μΠΤοτ ӡಈ ྑ͍ هࣄ2 μΠΤοτ ӡಈ
ӫཆ ࣭ ྑ͍ هࣄ3 ࣭ μΠΤοτ ѱ͍ هࣄ4 ӫཆ μΠΤοτ ӫཆ ࣭ ѱ͍
UGJEGͩͯ͠ΈΔ هࣄ༰ KPI هࣄ1 هࣄ2 μΠΤοτ ӡಈ μΠΤοτ ӡಈ ӫཆ
࣭ ྑ͍ هࣄ3 هࣄ4 ࣭ μΠΤοτ ӫཆ μΠΤοτ ӫཆ ࣭ ѱ͍
UGJEGͩͯ͠ΈΔ tf-idf μΠΤοτ ӡಈ ӫཆ ࣭ هࣄ1 هࣄ2 ※KPIྑ͍ 0.54
0.75 0.27 0.27 هࣄ3 هࣄ4 ※KPIѱ͍ 0.56 0 0.58 0.58
UGJEGͩͯ͠ΈΔ tf-idf μΠΤοτ ӡಈ ӫཆ ࣭ هࣄ1 هࣄ2 ※KPIྑ͍ 0.54
0.75 0.27 0.27 هࣄ3 هࣄ4 ※KPIѱ͍ 0.56 0 0.58 0.58 ӡಈͷهࣄ͕ Αͦ͞͏ʂ
ࢪࡦ ྑ͛͞ͳ୯ޠ͔ΒੜίϯςϯπΛ࡞͢Δ
݁Ռ DAUҰਓ͋ͨΓͷPV্͕ʂ
·ͱΊ • tf-idf • PythonͰ؆୯ʹͩ͢͜ͱ͕Ͱ͖Δ • จষͷத͔ΒಛޠΛநग़Ͱ͖Δ • ͬ͘͟ΓͱέΔ/έͳ͍ΩʔϫʔυͷΛ͔ͭΊΔ •
ςΩετͷཁྨͷ࠷ॳͷҰาʹ͓͢͢Ί • ࠓճهࣄͷࣄྫ͕ͩɺϝϧϚΨɾϓογϡ௨ͳͲ Ͱ͑Δͣ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ