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
850
みんなのPython勉強会#38登壇資料 tf-idfを使ったグロースハック
sugaya takehiro
September 12, 2018
Tweet
Share
Other Decks in Technology
See All in Technology
サイバー攻撃を想定したセキュリティガイドライン 策定とASM及びCNAPPの活用方法
syoshie
3
1.3k
20241214_WACATE2024冬_テスト設計技法をチョット俯瞰してみよう
kzsuzuki
3
450
KubeCon NA 2024 Recap / Running WebAssembly (Wasm) Workloads Side-by-Side with Container Workloads
z63d
1
250
バクラクのドキュメント解析技術と実データにおける課題 / layerx-ccc-winter-2024
shimacos
2
1.1k
KubeCon NA 2024 Recap: How to Move from Ingress to Gateway API with Minimal Hassle
ysakotch
0
200
Storage Browser for Amazon S3
miu_crescent
1
140
AWS re:Invent 2024 ふりかえり
kongmingstrap
0
130
DevOps視点でAWS re:invent2024の新サービス・アプデを振り返ってみた
oshanqq
0
180
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
2
110
Fanstaの1年を大解剖! 一人SREはどこまでできるのか!?
syossan27
2
170
ずっと昔に Star をつけたはずの思い出せない GitHub リポジトリを見つけたい!
rokuosan
0
150
C++26 エラー性動作
faithandbrave
2
730
Featured
See All Featured
Designing for Performance
lara
604
68k
A better future with KSS
kneath
238
17k
Making the Leap to Tech Lead
cromwellryan
133
9k
The Cult of Friendly URLs
andyhume
78
6.1k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Documentation Writing (for coders)
carmenintech
66
4.5k
KATA
mclloyd
29
14k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
98
How STYLIGHT went responsive
nonsquared
95
5.2k
Mobile First: as difficult as doing things right
swwweet
222
9k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
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Ͱ؆୯ʹͩ͢͜ͱ͕Ͱ͖Δ • จষͷத͔ΒಛޠΛநग़Ͱ͖Δ • ͬ͘͟ΓͱέΔ/έͳ͍ΩʔϫʔυͷΛ͔ͭΊΔ •
ςΩετͷཁྨͷ࠷ॳͷҰาʹ͓͢͢Ί • ࠓճهࣄͷࣄྫ͕ͩɺϝϧϚΨɾϓογϡ௨ͳͲ Ͱ͑Δͣ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ