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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
jeey
May 29, 2020
Science
900
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
3k
対数変換ってしてもいいの? / Is it really okey to do Log Transformation
jeyjeyjeey
0
95
目的関数と評価指標 / Objective Function and Evaluation Metrics
jeyjeyjeey
0
230
ビッグデータの哲学 / Philosophy of Big Data
jeyjeyjeey
0
78
Webマーケティング業務のデータサイエンス ざっくり編 / data science in web marketing business (Big Picture)
jeyjeyjeey
0
130
Other Decks in Science
See All in Science
データベース06: SQL (3/3) 副問い合わせ
trycycle
PRO
1
1.1k
Van Dare naar Durf
voginip
0
310
Leitner Inauguration Lecture Chalmers University of Technology
xleitix
0
370
自社のレビュー履歴からAIコードレビュアーをつくる方法
estie
0
780
CVPR2026_VGGTとその仲間たち
mickey_0226
0
1.2k
大黒市で発生した大規模インシデント の ポストモーテムから読み解く、 記憶媒体消去の大切さ
shucho0103
0
280
機械学習 - ニューラルネットワーク入門
trycycle
PRO
0
1.3k
Conwayの法則を"ちゃんと"使うために — 原典でConwayは何を言っていたのか
bonotake
10
7.3k
東北地方における過去20年間の降水量の変化
naokimuroki
1
530
Toward Causal Scientific Discovery with AI
sshimizu2006
0
200
J-STAGE全文XML登載必須化について
xspa2012
0
1.6k
データベース11: 正規化(1/2) - 望ましくない関係スキーマ
trycycle
PRO
0
1.7k
Featured
See All Featured
How to build a perfect <img>
jonoalderson
1
6k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
It's Worth the Effort
3n
188
29k
Paper Plane (Part 1)
katiecoart
PRO
2
11k
How to make the Groovebox
asonas
2
2.5k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
250
RailsConf 2023
tenderlove
30
1.6k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
エンジニアに許された特別な時間の終わり
watany
109
250k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
GitHub's CSS Performance
jonrohan
1033
470k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.3k
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 ࢀߟ