From cbb551537a2505d8f189a4faf9e8c67fe1753d47 Mon Sep 17 00:00:00 2001 From: nunzip Date: Thu, 28 Feb 2019 00:01:09 +0000 Subject: Graph both loss and accuracy --- lenet.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lenet.py b/lenet.py index 2372857..31664ee 100644 --- a/lenet.py +++ b/lenet.py @@ -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) -- cgit v1.2.3