![Page 1: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/1.jpg)
An Introduction to Statistical Learning
4 Classification
高橋秀征
![Page 2: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/2.jpg)
説明変数量的変数 質的変数
被説明変数
量的変数
最小二乗法 最小二乗法ダミー変数
質的変数
? ?
![Page 3: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/3.jpg)
4 章 Classification
4.1 使うデータの紹介4.2 線形回帰での分析4.3 ロジスティック回帰4.4 線形判別分析4.5 分類理論( Classification Methods) の比較
![Page 4: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/4.jpg)
4 章 Classification
4.1 使うデータの紹介4.2 線形回帰での分析4.3 ロジスティック回帰4.4 線形判別分析4.5 分類理論( Classification Methods) の比較
![Page 5: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/5.jpg)
4.1 概観n=10000Income: 年収($ ? )Balance :月のクレジットカード支払い( $ ?)
○ :債務履行 ( 図では一部省略 )+:債務不履行 ( 全体の 3%)
以降この Default Data を用いて分析する
![Page 6: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/6.jpg)
4.1 概観【定性的に】カード支払いが多ければ債務不履行になりやすい。 ⇓【定量的に】Balance,Incomeがある値の時に、どれだけ債務不履行に陥りやすいのか?
![Page 7: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/7.jpg)
4 章 Classification
4.1 使うデータの紹介4.2 線形回帰での分析4.3 ロジスティック回帰4.4 線形判別分析4.5 分類理論( Classification Methods) の比較
![Page 8: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/8.jpg)
4.2 線形回帰で求めたら?
このように解釈する
![Page 9: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/9.jpg)
4.2 線形回帰で求める※ を赤線で示した
【問題点】① 変化が鈍い
② で無い
【結論】線形回帰では無理がある
Pr ¿
![Page 10: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/10.jpg)
4.2 線形回帰で求める問題点を解決したものが右の図になる
右の図はロジスティック回帰( Logistic Regression) で作れる
![Page 11: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/11.jpg)
ロジスティック回帰って何?
![Page 12: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/12.jpg)
4 章 Classification
4.1 使うデータの紹介4.2 線形回帰での分析(ダメな理由)4.3 ロジスティック回帰4.4 線形判別分析4.5 分類理論( Classification Methods) の比較
![Page 13: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/13.jpg)
4.3 ロジスティック回帰とはがあるカテゴリに入る確率を求めるモデル
⇓が質的変数の時に使える
(は説明変数の条件付き確率となる)
今回の例だと
( 以降と略記する)
![Page 14: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/14.jpg)
4.3.1 (一変数の)ロジスティック関数
天下り的に与えるとロジスティック関数は以下のようになる。
これはを満たす S 字型の曲線となる。
![Page 15: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/15.jpg)
4.3.1 (一変数の)ロジスティック関数
オッズ( odds)失敗と成功の比
ロジット( logit)
![Page 16: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/16.jpg)
4.3.1 (一変数の)ロジスティック関数
![Page 17: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/17.jpg)
4.3.2 回帰係数の推定最尤法 (maximum likelihood) を用いる
尤度関数 (likelihood function)
を最大にするを求める
![Page 18: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/18.jpg)
4.3.2 (補足)最尤法標本値xを観測したのは、xを観測する確率が高かったからだと想定
⇓xを観測したのは、xを観測する確率が最大だったからと想定
⇓パラメータの真の値はxを観測する同時確率(尤度)を最大にする値だったと想定する
参照:藤澤洋徳著『確率と統計』
よって、尤度関数を最大にするパラメータを求める
![Page 19: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/19.jpg)
4.3.2 回帰係数の推定を推定する
Default Data の推定結果
この係数が本当に影響しているかどうかは以下の検定で確かめる必要がある
![Page 20: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/20.jpg)
4.3.2 推定結果の検定
の下での
を満たせばは有意水準 5% で有意である。
はがある値の時に、それが起こる確率
![Page 21: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/21.jpg)
4.3.2 推定結果の検定
検定の結果、 は有意水準 5% で有意と分かった。
よって
と言える。
![Page 22: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/22.jpg)
4.3.2 説明変数が質的変数の場合を推定する
検定の結果、 は有意水準 5% で有意と分かった。
但し
![Page 23: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/23.jpg)
被説明変数が二値変数
ロジスティック 回帰
係数の推定
最尤法
尤度関数
説明変数が質的変数
ダミー変数
説明変数が一つ
![Page 24: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/24.jpg)
4.3.4 ( 2 変数以上の)ロジスティック回帰
但しの行ベクトル
![Page 25: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/25.jpg)
4.3.4 係数の推定以下の尤度関数を最大にするような係数を求める
収入は関係なく、学生であるか否かが重要
![Page 26: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/26.jpg)
4.3.4 1 変数と多変数の結果比較
一変数
多変数
係数の正負が異なっている矛盾しているのではないか?
![Page 27: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/27.jpg)
4.3.4 1 変数と多変数の結果比較
一変数:収入や債務残高の情報が全くなけれ ば、全体平均で見ると、学生の方が不 履行になりやすい。
多変数:収入と債務残高が全く同じ学生と非学 生がいたら、学生の方が不履行になり にくい。
![Page 28: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/28.jpg)
4.3.4 1 変数と多変数の結果比較
水色・・・非学生オレンジ・・・学生
破線・・・全体平均実線・・・ある条件下で
水色実線>橙色実線水色波線<橙色波線
![Page 29: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/29.jpg)
4.3.4 交絡( Confounding )債務残高と学生の箱ひげ図を見ると相関が読み取れる
⇓独立変数( Predictor)の間に相関がある
⇓この現象のことを交絡( Confounding) と言う
単回帰の結果と重回帰の結果を大きく変える要因
![Page 30: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/30.jpg)
Default Data
Income を無しと仮定すると
income
studentdefault
+
-
+
+
-
![Page 31: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/31.jpg)
被説明変数が二値変数
ロジスティック 回帰
係数の推定
最尤法
尤度関数
説明変数が質的変数
ダミー変数
説明変数が一つ
説明変数が二つ 交絡
![Page 32: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/32.jpg)
説明変数量的変数 質的変数
被説明変数
量的変数
最小二乗法 最小二乗法 ダミー変↳
数質的変数
ロジスティック回帰
ロジスティック回帰↳ダミー変数
![Page 33: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/33.jpg)
4.3.5 二値以上の階級の分類今までの内容は二値変数(債務不履行になるか否
か)での分類⇓
二値以上の場合はどうするのか⇓
ロジスティック関数を拡張すれば可能しかし、あまり使われていない
⇓(線形)判別分析(( Linear)Discriminant analysis )が
よく使われる
![Page 34: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/34.jpg)
(線形)判別分析って何?
![Page 35: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/35.jpg)
4 章 Classification
4.1 使うデータの紹介4.2 線形回帰での分析(ダメな理由)4.3 ロジスティック回帰4.4 線形判別分析4.5 分類理論( Classification Methods) の比較
![Page 36: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/36.jpg)
4.4 線形判別分析【メリット】①群がきっちり分けられている時、ロジスティック回帰より線形判別分析の方がパラメータ推定が安定する② 標本数が少なく、各群におけるXの分布がほぼ正規分布に従っている時、ロジスティック回帰より線形判別分析の方が安定する。③群が 3つ以上の時、線形判別分析はよく使わ れる
![Page 37: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/37.jpg)
4.4 線形判別分析ロジスティック回帰:モデル化したものは、ある Xの時のYの条件付き分布 正規分布を仮定したやや間接的なアプローチ
線形判別分析:各群ごとにXの分布を別々にモデ ル化する ベイズの定理を用いる
![Page 38: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/38.jpg)
ベイズの定理って何?
Thomas Bayes1702-1761
![Page 39: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/39.jpg)
4.4.1 ベイズの定理
![Page 40: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/40.jpg)
4.4.1 ベイズの定理
ベイズの定理は、原因の確率に関する定理だと言える。今、k個の排反なあらゆる群(原因)を想定する。「各群(原因)である確率」は求められるものであるとする。データxを抽出した(結果が生じた)時、各原因が結果を生じさせる条件付き確率を想定する。ベイズの定理とは、以上の条件から、ある結果が得られた時に、ある原因から発生した確率を求められると言うものである。
参照『自然科学の統計学』東大出版会
![Page 41: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/41.jpg)
4.4.1 ベイズの定理
:事前確率( Prior probabirity) 個の群からあるを選ぶ確率
:第 k群である時に、 X=x である確率
とし、密度関数として扱う。
:事後確率 (Posterior probabirity) X=x である時に、第 k群である確率
![Page 42: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/42.jpg)
4.4.1 ベイズの定理
ベン図で考えると分かりやすい。
事後確率 事前確率
![Page 43: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/43.jpg)
4.4.1 ベイズの定理
と置き、確率関数として扱う。
を推定したい⇓
事前確率は比較的推定が楽⇓
推定が少し困難を推定する
![Page 44: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/44.jpg)
4.4.2 の仮定分布について正規分布( normal),ガウス分布 (Gaussian) の仮定を置く
:第 k群における期待値:第 k群における分散
![Page 45: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/45.jpg)
4.4.2 各群の分散は一定と仮定
![Page 46: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/46.jpg)
4.4.2 単一のパラメータでの LDA
ベイズの定理の公式に代入
の時、上の式の値を最大にするような群に分類される⇓
値の大小は分子に依存 (∵分母は一定)⇓
分子の大小と、自然対数を取ったものの大小関係は同じ
![Page 47: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/47.jpg)
4.4.2 単一のパラメータでの LDA
分子のみに対数をとり、第 k群に関する項だけを新しい関数として定義する
が最大となるではも最大となる。この関数はについて線形であるので線形判別分析という
![Page 48: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/48.jpg)
4.4.2 単一のパラメータでの LDA
今までの話は、真のパラメータが既知の場合⇓
実際は推定量を用意しなければならない
①期待値② 分散の推定③事前確率の推定
![Page 49: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/49.jpg)
4.4.2 単一のパラメータでの LDA
①
②
③
但しは第 k群のデータ数
![Page 50: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/50.jpg)
4.4.2 単一のパラメータでの LDA
以上の推定量をに入れてを作る
線形判別分析ではの時、このを最大にするような、k群にを分類する。
![Page 51: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/51.jpg)
4.4.3 多変量の LDA
P次元のガウス分布 を分析のために準備する
を準備する
![Page 52: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/52.jpg)
4.4.3 多変量の LDA
第 k群については
但し、分散共分散行列は各群に共通とする
![Page 53: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/53.jpg)
4.4.3 多変量の LDA
ベイズの定理の公式にを代入分子に対数を取り、第 k群に関する項だけを新しい関数とする
の時に、この関数の値が最大となる群に分類される
![Page 54: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/54.jpg)
4.4.3 多変量の LDA
LDA で Default Data を検証⇓
全体の誤り率は⇓
当てはまりとしてはかなり良いのでは?
⇓但し注意点が
真の状態履行 不履行 計
予測した状態
履行
9644 252 9896
不履行
23 81 104
計 9667 333 10000
![Page 55: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/55.jpg)
4.4.3 分析の注意点1.訓練データの誤り率<テストデータでの誤り率 となることが多い。 サンプル数に対してパラメータ数が大きいと 過適合が起こりやすい。
2.全ての人を「履行」と分類する分類器を想定 したら、その全体の誤り率は
⇓「不合理」な分類器と大差ない
![Page 56: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/56.jpg)
4.4.3 2種類の過誤
偽陽性:真の状態が「履行( Neg)」なのに「不履行( Pos)」と分類してしまう
偽陰性:真の状態が「不履行( Pos)」なのに「履行( Neg)」と分類してしまう
Confusion Matrix
![Page 57: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/57.jpg)
4.4.3 2種類の過誤薬学・生物学等の分野では感度 (Sensitivity) や特異度 (Specificity) という指標で分類器の性能を表す
【今回の例】感度(偽陰性率):債務不履行 (Pos) の状態を正しく分類できたか
特異度(偽陽性率):債務履行 (Neg) の状態を正しく分類できたか
![Page 58: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/58.jpg)
4.4.3 2種類の過誤
感度( True Positive Rate)
特異度( True Negative Rate)
真の状態履行
(Negative)不履行( Positive
)
計
予測した状態
履行不履行計
![Page 59: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/59.jpg)
4.4.3 閾値の設定
修正前
閾値を修正する⇓修正後
」
カード会社が気になる部分誤りが多い
⇓LDAを修正する必要あり
![Page 60: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/60.jpg)
4.4.3 閾値の設定
気になる部分の誤り率(偽陰性
率)は改善された
75.7%→ 41.4%⇓
全体としての誤り率は上昇している2.75%→ 3.73%
修正前
修正後
![Page 61: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/61.jpg)
4.4.3(補足) 線形判別と誤り率
誤判別する確率を最小にする、という観点から線形判別分析を考える。群に分類する状況を想定して行う。
記号の準備:母集団の確率密度関数:xがから選ばれる確率(事前確率):x が得られた時に、 と判別する確率: からのサンプルをと判別した時の損失
![Page 62: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/62.jpg)
4.4.3(補足) 線形判別と誤り率
真の状態
計
予測した状態
計 1 1
群
事前確率
判別する確率
損失
期待損失
![Page 63: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/63.jpg)
4.4.3(補足) 線形判別と誤り率
よってxが得られた時の損失の期待値は
これを最小化する。
![Page 64: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/64.jpg)
![Page 65: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/65.jpg)
4.4.3 閾値の設定
:全体の誤り率 ・・・・・・:偽陽性率 ---:偽陰性率
真の状態履行
(Negative)不履行( Positive
)
計
予測した状態
履行不履行計
![Page 66: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/66.jpg)
4.4.3 閾値の決定
【定性的】 閾値を下げる⇓
「不履行 (Pos)」の人を間違えて「履行 (Neg)」と判断する確率 (偽陰性率)は下がり、全体の誤り率は上昇する
【定量的】どこまで閾値を下げればいいのか?
![Page 67: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/67.jpg)
4.4.3 閾値の決定ROC 曲線( ROC curve) を導入する・ ROC は通信理論 (Communication theory) における受信者動作特性( Reciever Operating Characteristic) の頭文字から・曲線以下の領域を ROC 曲線下面積・AUC(Area Under the Curve) と呼ぶ・理想的な ROC 曲線は左上に接する
![Page 68: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/68.jpg)
4.4.3 ROC 曲線理想的な点
ROC曲線
ROC曲線下面積AUC感度
偽陽性率
![Page 69: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/69.jpg)
4.4.3 ROC 曲線
真の状態
履行(Negative)
不履行( Positive
)
計
予測した状態
履行不履行
計
閾値 0.2 0.5
感度 0.586 0.243
偽陰性率 0.414 0.757
特異度 0.976 0.998
偽陽性率 0.024 0.002
![Page 70: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/70.jpg)
真の状態
履行(Negative)
不履行( Positive)
計
予測した状態
履行不履行
計
![Page 71: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/71.jpg)
4.4.4 二次判別分析線形判別分析の仮定①各群は固有の期待値を持つ②各群は等分散③各群での観測値は正規分布に従う
⇓
⇓等分散の仮定を外す
⇓
![Page 72: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/72.jpg)
4.4.4 二次判別分析ベイズの定理の公式にを代入した
分子のみに対数をとり、番目に関する項だけを新しい関数として定義する
が最大となるではも最大となる。この関数はについて二次であるので二次判別分析という
![Page 73: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/73.jpg)
4.4.4 二次判別分析第 k群については
を仮定する
![Page 74: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/74.jpg)
4.4.4 二次判別分析ベイズの定理の公式にを代入分子に対数を取り、番目の階級に関する項だけを新しい関数とする
の時に、この関数の値が最大となる階級に分類される
![Page 75: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/75.jpg)
4.4.4 LDA と QDA の比較変数の種類をとして、分散共分散行列を計算することを考える。
LDA は個のパラメータを推定する必要がある。
QDA は個のパラメータを推定する必要がある。
![Page 76: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/76.jpg)
4.4.4 LDA と QDA の比較LDA
・分散は各群に共通・推定するパラメータ数が少ない・柔軟性が低い・分散の値が低くなる・バイアスが高い
∴データ数が小さい時に使える
QDA・分散は各群で異なる・推定するパラメータ数が多い・柔軟性が高い・分散の値が高くなりがち・バイアスが低い
∴データ数が大きい時に使える
![Page 77: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/77.jpg)
4.4.4 LDA と QDA の比較等分散の条件の下2 値の分類を考える
ベイズによる境界LDA による境界QDA による境界
QDA は必要以上にバイアスを減らし、分散が大きくなっている
⇓LDA の方が良く推定できている𝜎 112=𝜎212=0.7 Σ 1=Σ 2
![Page 78: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/78.jpg)
4.4.4 LDA と QDA の比較不等分散の条件の下2 値の分類を考える
𝜎 112=0.7𝜎 212=−0.7 Σ1≠ Σ2
ベイズによる境界LDA による境界QDA による境界
QDA の方が良く推定できている
![Page 79: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/79.jpg)
4 章 Classification
4.1 使うデータの紹介4.2 線形回帰での分析(ダメな理由)4.3 ロジスティック回帰4.4 線形判別分析4.5 分類理論( Classification Methods) の比較
![Page 80: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/80.jpg)
4.5 ロジスティック回帰と LDA
一変量のデータを二値に分けることを考える。とする。
線形判別分析でのロジットは
![Page 81: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/81.jpg)
4.5 ロジスティック回帰と LDA
適宜整理すると
LDA の場合、決定境界は線形であるが、その係数の推定には正規分布の仮定から導かれる、平均と分散が用いられる
![Page 82: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/82.jpg)
4.5 ロジスティック回帰と LDA
ロジスティック回帰の場合のロジットは
である。
ロジスティック回帰の場合、決定境界は線形であるが、係数の推定には最尤法が用いられる。
![Page 83: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/83.jpg)
4.5 シナリオ1
観測値は各階級 20ずつ平均は各階級で異なるが、無相関である階級間での分散共分散行列は同じ
⇓決定境界は線形になる
⇓LDA の想定に最も適合する
![Page 84: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/84.jpg)
4.5 シナリオ 2
観測値は各階級 20ずつ独立変数は各階級共に -0.5 の相関を持つ階級間での分散共分散行列は同じ
⇓決定境界は線形となる
⇓LDA が最もパフォーマンスが良い
![Page 85: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/85.jpg)
4.5 シナリオ 3
観測値は t 分布からの無作為抽出(t分布は正規分布より裾が広い)各階級 50ずつの観測値を抽出
⇓決定境界は線形となる
⇓ロジスティック回帰の設定に最も適合する
正規分布の仮定を満たさないので QDAや LDA の当てはまりが悪いQDA は線形の仮定を外しているので、より当てはまりが悪い
![Page 86: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/86.jpg)
4.5 シナリオ 4
観測値は正規分布からの無作為抽出各階級 50ずつの観測値を抽出一つ目の階級は相関係数 0.5ニつ目の階級は相関係数 -0.5階級によって分散共分散行列が異なる
⇓決定境界は非線形
⇓QDA の想定に最も適合する
![Page 87: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/87.jpg)
4.5 シナリオ 5観測値は正規分布からの無作為抽出各階級 50ずつの観測値を抽出無相関応答変数はを含むロジスティック関数から抽出
⇓決定境界は二次曲線(非線形)
⇓QAD の想定に最も適合線形を想定する LDA やLogiatic は当てはまりが悪い
![Page 88: An introduction to statistical learning 4 logistic regression manu](https://reader031.vdocuments.mx/reader031/viewer/2022032100/55ca911bbb61eb930a8b47a9/html5/thumbnails/88.jpg)
4.5 シナリオ 6
観測値は正規分布からの無作為抽出各階級 50ずつの観測値を抽出相関係数 0応答変数はシナリオ 5 よりも複雑な非線形の関数から抽出
⇓決定境界は複雑な非線形
⇓QDA でも十分にデータをモデル化出来ないK近傍法も K の値によってパフォーマンスは異なる
⇓K の値を適切に選ぶことが重要