Modelvalidatie

Introductie tot Deep Learning in Python

Dan Becker

Data Scientist and contributor to Keras and TensorFlow libraries

Validatie in deep learning

  • Gebruik meestal een validatiesplit i.p.v. cross-validatie

  • Deep learning wordt vaak gebruikt op grote datasets

  • Eén validatiescore steunt op veel data en is betrouwbaar

  • Herhaald trainen via cross-validatie kost veel tijd

Introductie tot Deep Learning in Python

Modelvalidatie

model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
model.fit(predictors, target, validation_split=0.3)
Epoch 1/10
89648/89648 [=====] - 3s - loss: 0.7552 - acc: 0.5775 - val_loss: 0.6969 - val_acc: 0.5561
Epoch 2/10
89648/89648 [=====] - 4s - loss: 0.6670 - acc: 0.6004 - val_loss: 0.6580 - val_acc: 0.6102
...
Epoch 8/10
89648/89648 [=====] - 5s - loss: 0.6578 - acc: 0.6125 - val_loss: 0.6594 - val_acc: 0.6037
Epoch 9/10
89648/89648 [=====] - 5s - loss: 0.6564 - acc: 0.6147 - val_loss: 0.6568 - val_acc: 0.6110
Epoch 10/10
89648/89648 [=====] - 5s - loss: 0.6555 - acc: 0.6158 - val_loss: 0.6557 - val_acc: 0.6126
Introductie tot Deep Learning in Python

Vroegtijdig stoppen

from tensorflow.keras.callbacks import EarlyStopping

early_stopping_monitor = EarlyStopping(patience=2)

model.fit(predictors, target, validation_split=0.3, epochs=20, 
          callbacks = [early_stopping_monitor])
Introductie tot Deep Learning in Python

Uitvoer van vroegtijdig stoppen

Train on 89648 samples, validate on 38421 samples
Epoch 1/20
89648/89648 [====] - 5s - loss: 0.6550 - acc: 0.6151 - val_loss: 0.6548 - val_acc: 0.6151
Epoch 2/20
89648/89648 [====] - 6s - loss: 0.6541 - acc: 0.6165 - val_loss: 0.6537 - val_acc: 0.6154
...
Epoch 8/20
89648/89648 [====] - 6s - loss: 0.6527 - acc: 0.6181 - val_loss: 0.6531 - val_acc: 0.6160
Epoch 9/20
89648/89648 [====] - 7s - loss: 0.6524 - acc: 0.6176 - val_loss: 0.6513 - val_acc: 0.6172
Epoch 10/20
89648/89648 [====] - 6s - loss: 0.6527 - acc: 0.6176 - val_loss: 0.6549 - val_acc: 0.6134
Epoch 11/20
89648/89648 [====] - 6s - loss: 0.6522 - acc: 0.6178 - val_loss: 0.6517 - val_acc: 0.6169
Introductie tot Deep Learning in Python

Experimenteren

  • Experimenteer met verschillende architecturen
  • Meer lagen
  • Minder lagen
  • Lagen met meer nodes
  • Lagen met minder nodes
  • Een goed model vraagt experimenteren
Introductie tot Deep Learning in Python

Laten we oefenen!

Introductie tot Deep Learning in Python

Preparing Video For Download...