diff options
-rw-r--r-- | lenet.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -116,7 +116,8 @@ def train_classifier(x_train, y_train, x_val, y_val, batch_size=128, epochs=100, model.compile(loss='categorical_crossentropy', metrics=metrics, optimizer=optimizer) history = model.fit(x_train, y_train, batch_size=batch_size, epochs=epochs, verbose=1, validation_data = (x_val, y_val)) - plot_history(history, metrics) + plot_history(history, 'categorical_accuracy') + plot_history(history) return model def test_classifier(model, x_test, y_true): @@ -157,5 +158,5 @@ def mix_data(X_train, y_train, X_validation, y_validation, train_gen, tr_labels_ if __name__ == '__main__': x_train, y_train, x_val, y_val, x_t, y_t = import_mnist() print(y_t.shape) - model = train_classifier(x_train[:100], y_train[:100], x_val, y_val, epochs=1) + model = train_classifier(x_train[:100], y_train[:100], x_val, y_val, epochs=3) test_classifier(model, x_t, y_t) |