STATLOG results Method Test Misclassification Error 2 4 6 8 10 12 14 0.0 0.05 0.10 0.15 LVQ RBF ALLOC80 CART Neural NewID C4.5 QDA SMART Logistic LDA DANN K-NN なぜK-近傍法を学ぶのか? 9 単純だが非常に強力な教師あり学習器 470 13. Prototypes and Nearest-Neighbors Spectral Band 1 Spectral Band 2 Spec Spectral Band 4 Land Usage Predicte FIGURE 13.6. The first four panels are LANDSAT images for a area in four spectral bands, depicted by heatmap shading. The r panels give the actual land usage (color coded) and the predicted lan スペクトル画像 農地の地質 Michie, D., Spiegelhalter, D.J. and Taylor, C.C. (1994) Machine Learning, Neural and Statistical Classification. Ellis Horwood, New York. STATLOGデータセットに対する分類精度は第2位
歴史的に成功事例が多いK-近傍法 10 画像2出典: https://ja.wikipedia.org/wiki/MNISTデータベース 画像3出典: https://www.shinyuri-hospital.com/column/column_202002.html ⼿書き⽂字認識 Spectral Band 4 Land Usage Predicted Land Usage FIGURE 13.6. The first four panels are LANDSAT images for an agricultural area in four spectral bands, depicted by heatmap shading. The remaining two panels give the actual land usage (color coded) and the predicted land usage using a five-nearest-neighbor rule described in the text. first problem, while 1-nearest-neighbor is best in the second problem by a factor of 18%. These results underline the importance of using an objective, data-based method like cross-validation to estimate the best value of a tuning parameter (see Figure 13.4 and Chapter 7). 13.3.2 Example: k-Nearest-Neighbors and Image Scene Classification The STATLOG project (Michie et al., 1994) used part of a LANDSAT image as a benchmark for classification (82×100 pixels). Figure 13.6 shows 衛星画像認識 ⼼電図の異常パターン検出
K-近傍法アルゴリズムの定式化 16 foreach x’ in S do compute dist(x, x’) take the top k nearest neighbors S’ from S foreach ci in C do !! ← # # ∈ %" &'( )*# # = )! | return argmax #!∈% !! 1 2 3 4 5 6 タスクに応じて設定 K近傍データの中でクラスci に属するデータの数 Input: x: ターゲットデータ Input: S: ラベル付きデータセット Input: C: クラスラベルのリスト Input: k: 閾値 Input: dist: 距離関数
教師あり学習の実践するときの基本的な流れ … データセット(特徴量x & ラベルyのリスト) データを⼀定の割合に分割 訓練データ テストデータ !!! ⋮ !!" "! !"! ⋮ !#" "# !#! ⋮ !$" "$ … B A B A A … B A B Step 1 訓練データを ⽤いた学習 Step 2 ML … A B A
教師あり学習の実践するときの基本的な流れ … データセット(特徴量x & ラベルyのリスト) データを⼀定の割合に分割 訓練データ テストデータ !!! ⋮ !!" "! !"! ⋮ !#" "# !#! ⋮ !$" "$ … B A B A A … B A B Step 1 訓練データを ⽤いた学習 Step 2 ML A … 推論結果 A B ラベルを隠してテスト データのラベルを推論 Step 3 … A B A …
教師あり学習の実践するときの基本的な流れ … データセット(特徴量x & ラベルyのリスト) データを⼀定の割合に分割 訓練データ テストデータ !!! ⋮ !!" "! !"! ⋮ !#" "# !#! ⋮ !$" "$ … B A B A A … B A B Step 1 ラベルを隠してテスト データのラベルを推論 Step 3 … A … 推論結果 B … 隠していたラベル 推論結果と元ラベル との⽐較による性能評価 Step 4 訓練データを ⽤いた学習 Step 2 ML A A B B … A B A
ホールドアウト法 … データセット(特徴量x & ラベルyのリスト) データを⼀定の割合に分割 訓練データ テストデータ !!! ⋮ !!" "! !"! ⋮ !#" "# !#! ⋮ !$" "$ … B A B A A … B A B Step 1 ラベルを隠してテスト データのラベルを推論 Step 3 A … 推論結果 B … 隠していたラベル 推論結果と元ラベル との⽐較による性能評価 Step 4 訓練データを ⽤いた学習 Step 2 ML A A B B … … A B A
シャッフルしない & ラベル分布を考慮しないデータ分割の問題 42 データセット … A A A B B Aは70% Bは30% A A A … 訓練データ (ラベルA=100%) B B … … 先頭から7:3に分割 テストデータ (ラベルB=100%) A … 推論結果 B … 隠していたラベル ML A B A B 偏った学習 偏った 性能評価 汎化性能の低下!!
汎化性能向上のためのデータ分割⽅法 43 データセット … A A A B B Aは70% Bは30% … 訓練データ (全体の50%) テストデータ (全体の50%) A 100% A 40% B 60% 訓練データ (全体の50%) テストデータ (全体の50%) A 70% B 30% A 70% B 30% シャッフル & 層別化分割 安直に前から50:50分割 シャッフル & 層別化(stratification)
汎化性能向上のためのデータ分割⽅法 45 データセット … A A A B B Aは70% Bは30% … 訓練データ (全体の50%) テストデータ (全体の50%) A 100% A 40% B 60% 訓練データ (全体の50%) テストデータ (全体の50%) A 70% B 30% A 70% B 30% 安直に前から50:50分割 シャッフル & 層別化分割 ダメ、絶対 シャッフル & 層別化(stratification)