SlideShare a Scribd company logo
多重共線性と線形回帰
の関係を見てみる
高度ICT領域 M1:濱口
未来大×サイバーエージェント社員(未来大OB/OG) 夏のLT大会
多重共線性が線形回帰に与える影響
• 分散共分散行列内に一次従属が存在する
• 統計学:どの説明変数が目的変数に寄与するか判断できない
• 機械学習:未知のデータの予測精度が落ちる可能性あり
32020/8/8
多重共線性が線形回帰に与える影響
• 分散共分散行列内に一次従属が存在する
• 統計学:どの説明変数が目的変数に寄与するか判断できない
• 機械学習:未知のデータの予測精度が落ちる可能性あり
X1, X2:説明変数
Y:目的変数
COVxx:分散共分散行列
• COVxxに一次従属が見られる
• 固有値が0
• 階数(rank)が下がる
• 逆行列が求まらない
42020/8/8
多重共線性が線形回帰に与える影響
X1, X2:説明変数
Y:目的変数
COVxx:分散共分散行列
• COVxxに一次従属が見られる
• 固有値が0
• 階数(rank)が下がる
• 逆行列が求まらない
多重共線性は分散共分散行列の固有値から
調べることができる
• 分散共分散行列内に一次従属が存在する
• 統計学:どの説明変数が目的変数に寄与するか判断できない
• 機械学習:未知のデータの予測精度が落ちる可能性あり
52020/8/8
分散共分散行列
確率変数 X, Y, Zとすると
COV =
COVxx COVxy COVxz
COVyx COVyy COVyz
COVzx COVzy COVzz
COVxy = E XY − E X E Y
E[ ∙ ]:期待値(定数) ≈ 平均
• 確率変数はゆらぐ(変数)ため,不変(定数)にしたい
分散共分散行列で確率変数を定数にすると
数値解析ができる
多変量正規分布でCOVxy
参照:
https://en.wikipedia.org/wiki/Multivariate
_normal_distribution
62020/8/8
分散共分散行列と線形回帰係数
• 線形回帰
y = θ1x1 + θ2x2 + … + θ 𝑛x 𝑛
y:目的変数
x:説明変数
θ:線形回帰係数
𝑛:説明変数の個数
𝛉 = [θ1, θ2 … θ 𝑛]を求めたい
• 正規方程式
𝛉 = (𝐗 𝐓
𝐗)−𝟏
𝐗 𝐓
𝐲
ここで
COVxx−1
= (𝐗 𝐓
𝐗)−𝟏
COVxy = 𝐗 𝐓 𝐲
とすることができる
𝛉 = COVxx−1
COVxy
• 線形回帰係数𝛉は正規方程式で求めることができる
多重共線性が発生しているとCOVxx−1 (逆行列)
をちゃんと求めることができない
72020/8/8
多重共線性を見つけて取り除く
• 分散共分散行列の固有値が0に近い説明変数を取り除く
固有値0.02以上
正規化[0,1]された説明変数から抽出した固有値
線形回帰係数と寄与の割合
固有値の大きさと説明変数の寄与は関係ない
x1
x2
x3
θ1 θ2 θ3
ソースコード:https://www.kaggle.com/hamamatcha/linear-regression-using-cov
82020/8/8
まとめ:多重共線性が線形回帰に与える影響
X1, X2:説明変数
Y:目的変数
COVxx:分散共分散行列
• COVxxに一次従属が見られる
• 固有値が0
• 階数(rank)が下がる
• 逆行列が求まらない
多重共線性はなくすべし
• 分散共分散行列内に一次従属が存在する
• 統計学:どの説明変数が目的変数に寄与するか判断できない
• 機械学習:未知のデータの予測精度が落ちる可能性あり
92020/8/8
おまけ:ランダムフォレスト(Xgboost)
はどうなの?
• 強み
• 値のスケーリングがいらない
• 高い精度を出すことが可能
• アンサンブル学習が強い
• 弱み
• 特徴量や,学習器を増やしすぎると学習に時間がかかる
• 多重共線性が存在する
多重共線性が存在するので,
変数重要度を調べたい場合は注意が必要
102020/8/8
おまけ:多重共線性とは
• 重回帰モデルにおける1つの説明変数が、他の説明変数から
線形予測できる現象
• 線形代数の一次独立,一次従属の話
• 一次独立の説明変数のみをそろえれば問題ないが,
意外と見落とされる
• 学習データ
• 影響がない
• 未知のデータ
• 精度の低下がみられる
• 境界平面が一意に定まらない
• 線形回帰係数θが学習ごとに大きく変化する
112020/8/8
おまけ:ほかに重要な部分は?
• データの分析に着目すると
• 特徴量選択:学習データの傾向を見る
ピアソンの相関係数
1, 0, -1に近いデータを観てみるのが意外といい
参照:https://en.wikipedia.org/wiki/Correlation_and_dependence
ピアソンの相関係数が1に近い説明変数をプロット
目的変数は”SalePrice”
122020/8/8

More Related Content

Recently uploaded

2024年5月25日Serverless Meetup大阪 アプリケーションをどこで動かすべきなのか.pptx
2024年5月25日Serverless Meetup大阪 アプリケーションをどこで動かすべきなのか.pptx2024年5月25日Serverless Meetup大阪 アプリケーションをどこで動かすべきなのか.pptx
2024年5月25日Serverless Meetup大阪 アプリケーションをどこで動かすべきなのか.pptx
ssuserbefd24
 

Recently uploaded (10)

2024年5月25日Serverless Meetup大阪 アプリケーションをどこで動かすべきなのか.pptx
2024年5月25日Serverless Meetup大阪 アプリケーションをどこで動かすべきなのか.pptx2024年5月25日Serverless Meetup大阪 アプリケーションをどこで動かすべきなのか.pptx
2024年5月25日Serverless Meetup大阪 アプリケーションをどこで動かすべきなのか.pptx
 
MPAなWebフレームワーク、Astroの紹介 (その2) 2024/05/24の勉強会で発表されたものです。
MPAなWebフレームワーク、Astroの紹介 (その2) 2024/05/24の勉強会で発表されたものです。MPAなWebフレームワーク、Astroの紹介 (その2) 2024/05/24の勉強会で発表されたものです。
MPAなWebフレームワーク、Astroの紹介 (その2) 2024/05/24の勉強会で発表されたものです。
 
LoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアル
LoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアルLoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアル
LoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアル
 
2024年度_サイバーエージェント_新卒研修「データベースの歴史」.pptx
2024年度_サイバーエージェント_新卒研修「データベースの歴史」.pptx2024年度_サイバーエージェント_新卒研修「データベースの歴史」.pptx
2024年度_サイバーエージェント_新卒研修「データベースの歴史」.pptx
 
【AI論文解説】Consistency ModelとRectified Flow
【AI論文解説】Consistency ModelとRectified Flow【AI論文解説】Consistency ModelとRectified Flow
【AI論文解説】Consistency ModelとRectified Flow
 
20240523_IoTLT_vol111_kitazaki_v1___.pdf
20240523_IoTLT_vol111_kitazaki_v1___.pdf20240523_IoTLT_vol111_kitazaki_v1___.pdf
20240523_IoTLT_vol111_kitazaki_v1___.pdf
 
YugabyteDB適用に向けた取り組みと隠れた魅力 (DSS Asia 2024 発表資料)
YugabyteDB適用に向けた取り組みと隠れた魅力 (DSS Asia 2024 発表資料)YugabyteDB適用に向けた取り組みと隠れた魅力 (DSS Asia 2024 発表資料)
YugabyteDB適用に向けた取り組みと隠れた魅力 (DSS Asia 2024 発表資料)
 
論文紹介: Exploiting semantic segmentation to boost reinforcement learning in vid...
論文紹介: Exploiting semantic segmentation to boost reinforcement learning in vid...論文紹介: Exploiting semantic segmentation to boost reinforcement learning in vid...
論文紹介: Exploiting semantic segmentation to boost reinforcement learning in vid...
 
論文紹介: Offline Q-Learning on diverse Multi-Task data both scales and generalizes
論文紹介: Offline Q-Learning on diverse Multi-Task data both scales and generalizes論文紹介: Offline Q-Learning on diverse Multi-Task data both scales and generalizes
論文紹介: Offline Q-Learning on diverse Multi-Task data both scales and generalizes
 
Amazon Cognitoで実装するパスキー (Security-JAWS【第33回】 勉強会)
Amazon Cognitoで実装するパスキー (Security-JAWS【第33回】 勉強会)Amazon Cognitoで実装するパスキー (Security-JAWS【第33回】 勉強会)
Amazon Cognitoで実装するパスキー (Security-JAWS【第33回】 勉強会)
 

Featured

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Saba Software
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
Simplilearn
 

Featured (20)

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
 

Lt slide 2020_0808_ multi_linearity