Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
分位点回帰 / quantile regression
Search
jeey
May 29, 2020
Science
920
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
分位点回帰 / quantile regression
jeey
May 29, 2020
More Decks by jeey
See All by jeey
uplift modeling
jeyjeyjeey
0
3.1k
対数変換ってしてもいいの? / Is it really okey to do Log Transformation
jeyjeyjeey
0
97
目的関数と評価指標 / Objective Function and Evaluation Metrics
jeyjeyjeey
0
230
ビッグデータの哲学 / Philosophy of Big Data
jeyjeyjeey
0
79
Webマーケティング業務のデータサイエンス ざっくり編 / data science in web marketing business (Big Picture)
jeyjeyjeey
0
130
Other Decks in Science
See All in Science
機械学習 - K-means & 階層的クラスタリング
trycycle
PRO
0
2.3k
[Relay webinaire eBIS actu n°16] Amélioration de la survie des JB avec la génétique - Introduction
institutdelelevage
PRO
0
380
Note agro-climatique et prairies - Numéro 7
institutdelelevage
PRO
0
640
AlgorithAlgorihms for Decision Making
mickey_kubo
0
180
はじめてのグラフ信号サンプリング
arthur1
0
140
Understanding CVP Waveforms: Interpretation and Clinical Implications in Anesthesiology
taka88
0
980
機械学習 - 決定木からはじめる機械学習
trycycle
PRO
0
1.7k
データベース03: 関係データモデル
trycycle
PRO
1
900
Kritische evaluatie van GenAI-output voor literatuuronderzoek
voginip
0
250
勾配流から乖離した学習ダイナミクス
hanbao
1
1.1k
Wet Active Matter
rajeshrinet
0
260
データベース11: 正規化(1/2) - 望ましくない関係スキーマ
trycycle
PRO
0
1.8k
Featured
See All Featured
How GitHub (no longer) Works
holman
316
150k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
370
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.7k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
A Soul's Torment
seathinner
8
3.8k
Faster Mobile Websites
deanohume
310
32k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
540
The Language of Interfaces
destraynor
162
27k
ラッコキーワード サービス紹介資料
rakko
2
5.4M
Designing for Performance
lara
612
70k
Transcript
Q u a n t i l e R e
g r e s s i o n Q u a n t i l e R e g r e s s i o n Q u a n t i l e R e g r e s s i o n Q u a n t i l e R e g r e s s i o n Q u a n t i l e R e g r e s s i o n Q u a n t i l e R e g r e s s i o n Q u a n t i l e R e g r e s s i o n Ґ ճؼ
1. ༧ଌͷ৴པੑͱ 2. ༧ଌͷ৴པੑͷϞσϦϯά 3. ϐϯϘʔϧଛࣦؔ 4. ଛࣦؔʹΑΔҐͷਪఆ 5. ར༻ՄೳͳϥΠϒϥϦ
1. ༧ଌͷ৴པੑͱ
Ͳͬͪͷ༧ଌಉ͘͡Β͍৴པͰ͖Δ͔ͳʁ
ੳ՝ʹ͓͍ͯɺ͋Δ༧ଌͷ֬ΛҙࢥܾఆͷҰॿͱ͍ͨ͠ ߹͕͋Δ ·ͨɺ࣮ଌΑΓ্ৼΕɾԼৼΕͨ͠Λࢀߟʹҙࢥܾఆͨ͠ ΄͏͕ɺ҆શଆͷஅͱͳΔ߹͕͋Δ ༧ଌͷ৴པੑ
༧ଌͷ෯͕ ͱͳΔ߹ ྫʣࢿஅ ࠷େརӹͱͳΔ༧ଌ͕ਪఆ͞Εͨͱͯ͠ɺͦ Ε͕ಉ࣌ʹ࠷རӹͱͳΔՄೳੑ͋Δ͘Β͍ෆ ֬ఆͳ༧ଌͰ͋Δ߹ɺͦΕΑΓརӹ ͍͕ݻ͍༧ଌͰࢿஅΛߦ͍͍ͨɺͱ͍͏ Α͏ͳϦεΫධՁಉ࣌ʹߦ͍͍ͨ߹͕͋Δ ʢϘϥςΟϦςΟͷ༧ଌʣ ͜ΜͳઢΛҾ͍ͯɺϦεΫͱϦλʔϯͷόϥϯε
Λͱͬͯҙࢥܾఆ͍ͨ͠
༧ଌͷ্ৼΕ͕ ͱͳΔ߹ ྫʣ৯খചۀऀ Ұൠʹ95%Ҏ্ͷඇৗʹߴ͍αʔϏεϨϕϧΛ ٻ͢Δʢͭ·ΓɺࡏݿΕඇৗʹكʣ ͜ͷ߹ɺଈ࣌ൢചͷࡏݿ͕ͳ͍ΑΓɺ༨ࡏݿ Λ๊͑Δ΄͏͕ྑ͍ͱஅ͞ΕΔ ্ৼΕͷઢΛҾ͍ͯɺ͜ͷ༧ଌͰҙࢥܾఆΛ͍ͨ͠
༧ଌͷԼৼΕ͕ ͱͳΔ߹ ྫʣࣗಈंϝʔΧʔ ৗʹੜ࢈ίετΛݮ͢ΔΑ͏ࢦ͓ͯ͠Γɺࡏ ݿθϩઓུΛબ͢ΔϝʔΧʔ͋Δʢं͕ߪೖ ͞Ε͔ͯΒɺͦͷޙੜ࢈͢Δʣ ͜ͷ߹ɺ༨ࡏݿΛ๊͑ΔΑΓɺଈ࣌ൢചͷࡏ ݿ͕ͳ͍΄͏͕ྑ͍ͱஅ͞ΕΔ ԼৼΕͷઢΛҾ͍ͯɺ͜ͷ༧ଌͰҙࢥܾఆΛ͍ͨ͠
Ҏ্ͷΑ͏ͳ߹ɺ͜ͷ༧ଌ۠ؒʢ্ৼΕɾԼৼΕʣ͕Θ͔ΔΑ͏ʹ ϞσϧΛ࡞ͨ͠΄͏͕ɺϏδωε՝ʹد༩Ͱ͖Δ߹͕͋Δ ༧ଌ۠ؒ
2. ༧ଌͷ৴པੑͷϞσϦϯά
ਪఆͰͳ͘ɺ্ৼΕɾԼৼΕΛਪఆ ͢ΔͨΊʹɺ༧ଌ۠ؒͷਪఆΛߦ ͍͍ͨ ࠓճɺҐͷਪఆΛߦ͏ࣄʹΑΓɺ ༧ଌ۠ؒͷਪఆΛߦ͏ख๏Λհ͢Δ ༧ଌ͕۠ؒΘ͔Δ΄͔ʹɺͦͷҐʹ ͓͚ΔภճؼͷมಈΘ͔Δ ࣌ܥྻϞσϧʹԠ༻Ͱ͖Δ ҐճؼʢΫΦϯλΠϧճؼʣ
3. ϐϯϘʔϧଛࣦؔ
ྫ͑ઢܗճؼͰతؔʹೋޡࠩؔΛ༻͍Δ ͕ɺҐճؼͰΘΓʹϐϯϘʔϧଛࣦؔʢඇ ରশઈରޡࠩؔʣΛ༻͍Δ ԼهͷΑ͏ʹॏΈ͚Λߦ͏ ࣮ଌͱ༧ଌͱͷࠩʢeʣ͕ਖ਼ͷͱ͖Н ࣮ଌͱ༧ଌͱͷࠩʢeʣ͕ෛͷͱ͖Н−̍ ϐϯϘʔϧଛࣦؔ ඍՄೳͳͷͰɺతؔͱͯ͠ධՁࢦඪͱͯ͠ ༻͍Δ͜ͱ͕Ͱ͖Δ τΛ0.5ͱ͢ΔͱதԝͱͳΔ
ϐϯϘʔϧଛࣦؔ ϐϯϘʔϧͷϘʔϧͷيಓʹɹ ࣅ͍ͯΔ͔ΒΒ͍͠ ࣮ͷϐϯϘʔϧ τΛΫΦϯλΠϧͱͯ͠ఆٛʢ95%ͳΒ0.95ʣ͠ɺ Нͷൣғଛࣦ͕ޡ͕ࠩ͘ධՁ͞Εɺൣғ֎Ͱ ޡ͕ࠩେ͖͘ධՁ͞ΕΔΠϝʔδ
4.ଛࣦؔʹΑΔ Ґͷਪఆ
͜ͷଛࣦؔͷ࠷খԽΛߦ͏͜ͱͱɺҐͷਪఆΛߦ͏͜ͱ͕ಉٛ Ͱ͋Δ͜ͱɺֶతʹಋ͘͜ͱ͕Ͱ͖Δ https://en.wikipedia.org/wiki/Quantile_regression ϐϯϘʔϧଛࣦؔͷܭࢉɺ ͋Δ֬ʹै͏֬ม:ʢ࣮ଌʣͱ ҐVͱͷࠩͷظͱݴ͍͑ͯྑ͍ ߹͚ʹैͬͯղ͢Δʢࢄͷ߹ʣ ࠷খԽͷͨΊɺVʹ͍ͭͯඍ ਪఆҐV R@aUBV
ʹ͓͚Δ:ͷྦྷੵີ͕Нͱ͘͠ͳΔ
5. ར༻ՄೳͳϥΠϒϥϦ
import statsmodels.formula.api as smf q = .975 mod = smf.quantreg('y
~ x', data) upper_mod = mod.fit(q=q) lower_mod = mod.fit(q=1-q) import lightgbm as lgb q = .975 clf_upper = lgb.LGBMRegressor(objective='quantile', alpha=q).fit(x, y) clf_lower = lgb.LGBMRegressor(objective='quantile', alpha=1-q).fit(x, y) # lossʹԼهͷΑ͏ͳϐϯϘʔϧଛࣦؔΛఆٛͯ͠ࢦఆ͢Δ class QuantileLoss(nn.Module): def __init__(self, quantiles): super().__init__() self.quantiles = quantiles def forward(self, preds, target): assert not target.requires_grad assert preds.size(0) == target.size(0) losses = [] for i, q in enumerate(self.quantiles): errors = target - preds[:, i] losses.append( torch.max( (q-1) * errors, q * errors ).unsqueeze(1)) loss = torch.mean( torch.sum(torch.cat(losses, dim=1), dim=1)) return loss ઢܗϞσϧʢPython: statsmodelsʣ ޯϒʔεςΟϯάܾఆʢPython: Lightgbmʣ Deep LearningʢPython: Pytorchʣ ઢܗϞσϧʢR: quantreg R͍ͬͺ͍͋Δʣ library(quantreg) rq(y~x, data=data, tau=seq(0,1,0.25))
※KaggleͰ༧ଌ۠ؒਪఆͷίϯϖ͕։࠵த
• R Koenker, Kf Hallock, Quantile Regression, Journal Of Economic
Perspectives, 2001 • Wikipedia, Quantile Regression • Https://En.Wikipedia.Org/Wiki/Quantile_Regression • Lokad • Https://Www.Lokad.Com/Jp/Ґ༧ଌ-ٕज़ • Https://Www.Lokad.Com/Jp/ΫΥϯλΠϧ-ճؼ-ʢ࣌-ܥྻʣ-ఆٛ • Https://Www.Lokad.Com/Jp/ϐϯϘʔϧϩεػೳ-ఆٛ • ҐճؼΛͬͯɺʮͦͷճؼ༧ଌͲΕ͙Β͍֎ΕΔͷʁʯΛઆ໌͢Δ • Https://Devblog.Thebase.In/Entry/2018/12/06/110655 • Qrnn χϡʔϥϧωοτΛ༻͍ͨҐճؼ • Https://Aotamasaki.Hatenablog.Com/Entry/2019/01/29/191604 • ฏۉ͔ΒҐɿҐճؼ • Https://Www.N-Insight.Co.Jp/Niblog/20150903-1087/ • Quantile Regression — Part 2 • Https://Medium.Com/The-Artificial-Impostor/Quantile-Regression-Part-2-6Fdbc26B2629 ࢀߟ