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
FukuokaR #7
Search
Hiroki Mizukami
March 25, 2017
Science
0
320
FukuokaR #7
https://www.amazon.co.jp/dp/4774188778
Hiroki Mizukami
March 25, 2017
Tweet
Share
More Decks by Hiroki Mizukami
See All by Hiroki Mizukami
音楽配信サービスにおける 推薦システムの概要と 数理モデルについて
hiroki_mizukami
0
200
CADEDA #6 AWAにおけるデータ利活用の取り組みと今後の展望について
hiroki_mizukami
4
2.2k
オンライン広告の数理モデルと数学ソフトウェア MSFD#23
hiroki_mizukami
6
4.5k
Other Decks in Science
See All in Science
はじめての「相関と因果とエビデンス」入門:“動機づけられた推論” に抗うために
takehikoihayashi
17
6.8k
WCS-LA-2024
lcolladotor
0
120
ベイズのはなし
techmathproject
0
290
化学におけるAI・シミュレーション活用のトレンドと 汎用原子レベルシミュレーター: Matlantisを使った素材開発
matlantis
0
260
Analysis-Ready Cloud-Optimized Data for your community and the entire world with Pangeo-Forge
jbusecke
0
110
Machine Learning for Materials (Lecture 8)
aronwalsh
0
410
【健康&筋肉と生産性向上の関連性】 【Google Cloudを企業で運用する際の知識】 をお届け
yasumuusan
0
330
AI科学の何が“哲学”の問題になるのか ~問いマッピングの試み~
rmaruy
1
2.2k
深層学習を利用して 大豆の外部欠陥を判別した研究事例の紹介
kentaitakura
0
230
ベイズ最適化をゼロから
brainpadpr
2
810
Sarcoptic Mange
uni_of_nomi
1
110
Pericarditis Comic
camkdraws
0
1.2k
Featured
See All Featured
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Typedesign – Prime Four
hannesfritz
40
2.4k
Unsuck your backbone
ammeep
668
57k
Site-Speed That Sticks
csswizardry
0
24
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Transcript
Ӣ Ӣ Ӣ Ӣ Ӣ Ӣ Ӣ Ӣ Ӣ Ӣ
Ӣ ֗ ֗ ֗ ֗ ֗ ֗ ֗ ֗ ֗ ֗ ొ ཽ
ཽ ܭ ౷ ొ ཧ ֬ 2
ཧϞσϦϯάͱɺ ౷ܭϞσϦϯάͱɺ ͦΕ͔Βɺࢲɻ 2
ཽ ܭ ౷ ొ ཧ ֬ 3
@ Fukuoka R Mar 25, 2017 य़ Hiroki Mizukami Destroy 3
ཽ ܭ ౷ ొ ཧ ֬ 4
※ݸਓͷݟղɻɻɻ 4
ཽ ܭ ౷ ొ ཧ ֬ 5
5 ࣗݾհͱ͝ΊΜͳ͍͞ ౷ܭϞσϦϯά ༧ଌͱ൚Խ ઢܗճؼϞσϧ ·ͱΊ ཧϞσϦϯά ղऍͱ൚Խ
• Έ͔ͣΈ ͻΖ͖ • LINE_ID: @piroyoung • αΠόʔܥͷAI Labɽ •
αʔόαΠυΤϯδχΞ • σʔλαΠΤϯςΟετ • ౦ژࡏॅʗԬग़ • ֶʗࠂʗWeb • Love έΰύʔΫ • R/Python/Scala/javascript/Spark/ Docker/AWS/Stan/Tableau/AWS/GCP ࣗݾհ ϔϏϝλ
Rݴޠ ʢڱٛʣ Rݴޠʢ͋ʔΔ͛Μ͝ʣΦʔϓϯιʔεɾϑϦʔιϑτΣΞͷ౷ܭղੳ͚ ͷϓϩάϥϛϯάݴޠٴͼͦͷ։ൃ࣮ߦڥͰ͋Δɻ RݴޠχϡʔδʔϥϯυͷΦʔΫϥϯυେֶͷRoss IhakaͱRobert Clifford GentlemanʹΑΓ࡞ΒΕͨɻݱࡏͰR Development Core
TeamʢSݴޠ։ൃऀ Ͱ͋ΔJohn M. Chambersࢀը͍ͯ͠Δ[1]ɻʣʹΑΓϝϯςφϯεͱ֦ு͕ͳ ͞Ε͍ͯΔɻ RݴޠͷιʔείʔυओʹCݴޠɺFORTRANɺͦͯ͠RʹΑͬͯ։ൃ͞Εͨɻ - wikipedia -
Rݴޠ ʢٛʣ σʔλੳΛੜۀͱ͢Δܑ͓͞Μ͓Ͷ͐͞ΜୡͷίϛϡχςΟͷ૯শɾ֓೦ɾε ϥϯάɻདྷΔͷશͯڋ·ͳ͍ελΠϧͰɺ࣮ࡍʹσʔλੳΛ͍ͬͯΔ͔ ͢ΒجຊతʹࣗݾਃࠂɻϢʔϞΞͱϢʔϞΞͱਓฑ͕ΛूΊΔϙΠϯτɽෳ ͷελʔτΞοϓϕϯνϟʔΛੜΈग़͍ͯ͠Δɽ ͱ͋Δ౷ܭʹΑΔͱ࣮ࡍʹRΛ͔ͭͬͯΔͻͱ Α͏͢ΔʹɼࠓRͷίΞͳ͠ͳ͍ͬͯ͜ͱͰ͢͢Έ·ͤΜɽ - mikipedia
-
ཽ ܭ ౷ ొ ཧ ֬ 9
9 ࣗݾհͱ͝ΊΜͳ͍͞ ౷ܭϞσϦϯά ༧ଌͱ൚Խ ઢܗճؼϞσϧ ·ͱΊ ཧϞσϦϯά ղऍͱ൚Խ
ཧϞσϦϯά ཧϞσϦϯά ͱσʔλͷதʹ͋ΔߏΛࣜͰهड़͢Δ͜ͱ ྫ͑͜Μͳσʔλ͕༗Δ ͜ͷͱ͖όωAʹؔͯ͠ ʦόωͷ͞ʧʹ 0.2 x [͓Γͷॏ͞] +
3 ͱݱʹؔ͢Δࣜͷදݱ͕ಘΒΕΔɽ
ཧϞσϦϯά Ͳ͏ͬͨʁ όωAʹؔͯ͠ҎԼͷ࿈ཱํఔ͕ࣜͨͯΒΕΔ ͜ΕΛղ͚
ཧϞσϦϯά Կ͕͏Ε͍͠ʁ • ݱ࣮ͷͷߟʹֶͷςΫχοΫͰ͑ΒΕΔɽ • ײ͕ٴͳ͍ʹ͑Δ • ݫີ • ఆྔత
• ʮόωAͷํ͕৳ͼ͍͢ʯ
ཧϞσϦϯά ݫີʻʼײɼఆྔతʻʼఆੑత ʮؾԹ͕ߴ͍ͱδϝδϝ͢ΔͶ͐ʯ ͜Ε͜ΕͰॏཁɽ
ཽ ܭ ౷ ొ ཧ ֬ 14
ʮͱΓ͋͑ͣɺՄࢹԽ͠Αʁʯ 14
ཽ ܭ ౷ ొ ཧ ֬ 15
ʮࣜɺͨͯΐʁʯ 15
ཽ ܭ ౷ ొ ཧ ֬ 16
ʮσʔλΛೖ͠Αʁʯ 16
ཽ ܭ ౷ ొ ཧ ֬ 17
ʮύϥϝλܭࢉͰ͖ͨ͊ʂʂʯ 17
ཽ ܭ ౷ ొ ཧ ֬ 18
18 Click = CTR · Imp
ཽ ܭ ౷ ొ ཧ ֬ 19
19 pV = nRT
ཽ ܭ ౷ ొ ཧ ֬ 20
20
ཽ ܭ ౷ ొ ཧ ֬ 21
21 ࣗݾհͱ͝ΊΜͳ͍͞ ౷ܭϞσϦϯά ༧ଌͱ൚Խ ઢܗճؼϞσϧ ·ͱΊ ཧϞσϦϯά ղऍͱ൚Խ
౷ܭϞσϦϯά ౷ܭϞσϦϯά ͱ֬ʹجͮ͘ཧϞσϦϯάɽ ֬มΛؚΉϞσϧࣜΛ༻͍Δɽ ֬มͱϥϯμϜͳৼΔ͍ʹ؍ଌΛରԠ͚ΔΈͷ͜ͱɽ ཁ͢Δʹ ʮ ͕ग़ͨ−ʂʂʯʹʼ 1 ͬͯͳ۩߹ɽ
X : ! 2 ⌦ 7! X(!) 2 R
౷ܭϞσϦϯά ࣄͱߟͷରͱ͢ΔϥϯμϜͳৼΔ͍ͷ͋ͭ·Γɽ ͜Ε؍ଌ͕͇ΛԼճΔͱ͍͏ৼΔ͍ͷू·Γͷ͜ͱ ֶతͳఆٛ X : ! 2 ⌦ 7!
X(!) 2 R X < x [ X < x ] := X 1([ 1 , x )) = { ! 2 ⌦| X ( ! ) < x }
౷ܭϞσϦϯά ֬ͱ؍ଌͷཚࡶ͞ͷֶతදݱ ͜Εਖ਼نͰ͜Μͳײ͡ʹද͢ɽ ʮ֬มX͕ฏۉμɼඪ४ภࠩσͷਖ਼نʹै͏ʯͱಡΉɽ μσͳͲͷΛݸੑ͚ΔύϥϝλΛ ͱ͍͏ɽ X ⇠ N(µ,
2)
౷ܭϞσϦϯά ਪఆͱɼσʔλΛͱʹΛ༧͢Δ͜ͱ ʮΉΉʔʂ͜Ε֬0.5Ͱද͕ग़Δͷ͔͠Εͳ͍ʂʯ ʮͬͺ10ͷ1͘Β͍͔͠Εͳ͍ɽɽɽʯ ͜ͷਪఆͷʢͬͱʣΒ͠͞ͱݺΕ͍ͯΔ ද ཪ ද ཪ ཪ
ཪ ཪ ཪ ཪ ཪ ཪ ཪ
ཽ ܭ ౷ ొ ཧ ֬ 26
26 ࣗݾհͱ͝ΊΜͳ͍͞ ౷ܭϞσϦϯά ༧ଌͱ൚Խ ઢܗճؼϞσϧ ·ͱΊ ཧϞσϦϯά ղऍͱ൚Խ
ઢܗճؼϞσϧ ҎԼͷΑ͏ͳσʔλ͕༗Δɽ ͕ɼ࣮෩͕ਧ͍ͯͯਖ਼֬ʹܭଌग़དྷͯͳ͍ͬΆ͍ɽ ࠷ॳͱ͓ͳ͡ઢܗͷϞσϧࣜʹσʔλΛೖͯ͠ΈΔͱ
ઢܗճؼϞσϧ
ཽ ܭ ౷ ొ ཧ ֬ 29
ղ͚ͳ͌ɻɻɻ 29
ཽ ܭ ౷ ొ ཧ ֬ 30
ղͷͳ͌ɺ࿈ཱํఔࣜɻɻɻ 30
ཽ ܭ ౷ ొ ཧ ֬ 31
୳ͯ͠ɺݟ͔ͭΒͳ͌ͬͯίτɻɻɻ 31
ཽ ܭ ౷ ొ ཧ ֬ 32
͏ŵŧƄແཧɻ౷ܭ͠ΐɻɻɻ 32
ઢܗճؼϞσϧ ͜ͷϞσϧ؍ଌޡ͕ࠩߟྀ͞Ε͍ͯͳ͌ɻɻɻ ਖ਼نͷޡࠩԾఆ͢Δ y = ✓0 + ✓1x +✏ y
= ✓0 + ✓1x ✏ ⇠ N(0, 2)
ઢܗճؼϞσϧ ਖ਼نʹै͏ޡࠩΛԾఆͨ͠ϞσϧΛઢܗճؼϞσϧͱ͍͏ ✏ ⇠ N(0, 2) Y (✓0 + ✓1X)
⇠ N(0, 2) Y ⇠ N(✓0 + ✓1X, 2)
ཽ ܭ ౷ ొ ཧ ֬ 35
ਪఆ͠ΐɻɻɻ 35
ઢܗճؼϞσϧ ਖ਼نʹै͏ޡࠩΛԾఆͨ͠ϞσϧΛઢܗճؼϞσϧͱ͍͏ Ұ൪Β͍͠θͱσΛܭࢉ͢Δ ͜͜Ͱ Y ⇠ N(✓0 + ✓1X, 2)
L(✓1, ✓2, ) = Y i 1 p 2⇡ 2 e (yi µi)2 2 2 µi = ✓0 + ✓1xi
ઢܗճؼϞσϧ ରؔ θͷਪఆԼઢ෦Λ࠷খʹ͢Ε͍͍ࣄ͕Θ͔Δ ͜ΕΛ࠷খ2๏ͱ͍͏ɽ = 0
ઢܗճؼϞσϧ σʹؔ͢Δํఔࣜ ͜ΕΛղ͚ ͕ಘΒΕΔɽ͜Εඪຊࢄɽ @ @ log L ( ✓1,
✓2, ) = 0 2 = 1 n X i (yi µi)2
ઢܗճؼϞσϧ Rͩͱ؆୯ʹܭࢉͰ͖Δɽ
ཽ ܭ ౷ ొ ཧ ֬ 40
PythonͩͬͨΒɻɻɻ statsmodels / sklearn.linear_model.*** 40
ཽ ܭ ౷ ొ ཧ ֬ 41
41 ࣗݾհͱ͝ΊΜͳ͍͞ ౷ܭϞσϦϯά ղऍͱ൚Խ ઢܗճؼϞσϧ ·ͱΊ ཧϞσϦϯά
ઢܗճؼϞσϧ ղऍλεΫ ؍ଌ͞Εͨσʔλͷੑ࣭ΛௐΔɽ ੑผ༧ଌϞσϧ αΠτAΛݟͯΔͷஉੑ͕ଟ͍ɽ
ઢܗճؼϞσϧ ղऍλεΫ ͜ͷCPAʢ͋ͨΓίετʣࢪࡦͷྑ͞ͷධՁͱͯ͠༗ޮ Ͱɽɽɽ ʮ2ஹԁग़ͨ͠ΔΘ ɼ2ԯCVΖʯʹʼ͑ͬɾɾɾ ͪΖΜແཧ͕͋Δ CV = 1
CPA · Cost
ઢܗճؼϞσϧ ղऍλεΫ ͜ͷCPAʢ͋ͨΓίετʣࢪࡦͷྑ͞ͷධՁͱͯ͠༗ޮ Ͱɽɽɽ ʮ2ஹग़ͨ͠ΔΘʯ ʹʼ 2ԯCVʁʁʁ ͪΖΜແཧ͕͋Δ CV =
1 CPA · Cost y=x/CPA
ઢܗճؼϞσϧ ൚ԽλεΫ ະͷσʔλʹର͢Δ༧ଌੑೳࢸ্ओٛ • Neural Network • Gradient Boosting Decision
Tree • SVM with some kernel • Ridge/Lasso • Feature Hashing ౷ܭతͳͷΈͰಈ͍͍ͯͳ͍͕ଟ͍ Α͘Θ͔ΒΜ͕Կނ͔ͨΔ
ઢܗճؼϞσϧ ൚ԽλεΫ minimize: loss(label, Feature) Feature Label
ཽ ܭ ౷ ొ ཧ ֬ 47
47 ࣗݾհͱ͝ΊΜͳ͍͞ ౷ܭϞσϦϯά ղऍͱ൚Խ ઢܗճؼϞσϧ ·ͱΊ ཧϞσϦϯά
• ཧϞσϦϯάΛ༻͍Εݱ࣮ͷΛֶͷϊ ϋͰղܾͰ͖Δ • ౷ܭతͳςΫχοΫΛ͏͜ͱͰߋʹॊೈʹ • ൚ԽͱղऍϞσϧผͷςΫχοΫ ·ͱΊ
ੈా୩۠ࡏॅ H.M͞Μ ʮ࠷ॳʰ͜Μͳॻ੶Ͱඞཁͳ͕ࣝΈʹͭ͘ͳΜͯɾɾɾʱͱ͍͏ؾ࣋ͪ ͋Γɺ৴ٙͰ͜ͷຊΛखʹऔΓ·ͨ͠ɻ͍͟खʹͱͬͯݟΔͱShell ScriptSQLͷجૅͪΖΜɼPythonʹΑΔ࣮ફతͳΞϓϦέʔγϣϯͷ ࡞Γํ·Ͱஸೡʹղઆ͞Ε͍ͯͯ༧Ҏ্ͷϘϦϡʔϜͰͨ͠ɻͱ͘ʹۤख ͩͬͨ౷ܭϞσϦϯάטΈࡅ͍ͯॻ͔Ε͍ͯͯऔֻ͔ͬΓʹ࠷ߴͩͬͨ ͱࢥ͍·͢ɻ2000ԁऑͱ͍͏Ձֶ֨ੜʹخ͍͠Ͱ͢ɻࠓͰຖ൴ঁͱ ͤʹΒͯ͠ډ·͢ɻʯ ͨͳ͠ΎΜύΫͬͨ͝ΊΜ