モデル性能の向上

PyTorchで学ぶIntroduction to Deep Learning

Jasmin Ludolf

Senior Data Science Content Developer, DataCamp

性能最大化の手順

$$

  • 問題は解けるか?

  • 性能の基準値を設定

$$

  • 検証セットの性能を向上

$$ $$

  • 可能な限り最高の性能を達成

手順1

手順2

手順3

PyTorchで学ぶIntroduction to Deep Learning

手順1: 学習データに過学習させる

  • 学習ループを変更し、単一データ点に過学習させる

    features, labels = next(iter(dataloader))
    for i in range(1000):
      outputs = model(features)
      loss = criterion(outputs, labels)
      optimizer.zero_grad()
      loss.backward()
      optimizer.step()
    
    • 精度1.0・損失0に到達するはず
  • その後、全学習データに拡大

    • 既定のハイパーパラメータを維持
PyTorchで学ぶIntroduction to Deep Learning

手順2: 過学習を抑える

  • 目的: 検証精度を最大化

  • 試す項目:

    • Dropout
    • Data augmentation
    • Weight decay
    • モデル容量の削減

$$

  • 各ハイパーパラメータと検証精度を記録

過学習

PyTorchで学ぶIntroduction to Deep Learning

手順2: 過学習を抑える

$$

元のモデルは学習データに過学習 元の性能

$$

更新後モデルは正則化が強すぎる 正則化が強すぎる

PyTorchで学ぶIntroduction to Deep Learning

手順3: ハイパーパラメータを微調整

  • グリッドサーチ
for factor in range(2, 6):
    lr = 10 ** -factor

グリッドサーチ

  • ランダムサーチ
factor = np.random.uniform(2, 6)
lr = 10 ** -factor

ランダムサーチ

PyTorchで学ぶIntroduction to Deep Learning

Ayo berlatih!

PyTorchで学ぶIntroduction to Deep Learning

Preparing Video For Download...