From 2bdebacbb7278c69c6dbd004da88ca5374072ec0 Mon Sep 17 00:00:00 2001 From: Panagiotis Baklesis Date: Fri, 22 May 2020 17:06:02 +0300 Subject: [PATCH] checking wandb --- network3.py | 10 ++++++++++ test.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/network3.py b/network3.py index ff8afa8..83d3b68 100644 --- a/network3.py +++ b/network3.py @@ -47,6 +47,12 @@ def ReLU(z): return T.maximum(0.0, z) from theano.tensor.nnet import sigmoid from theano.tensor import tanh +#import wandb to monitor resource consumption +wandb.init(project="my-project") + +#set hyperparameters for wandb +wandb.config.dropout = 0.2 +wandb.config.hidden_layer_size = 128 #### Constants GPU = True @@ -156,6 +162,8 @@ def SGD(self, training_data, epochs, mini_batch_size, eta, # Do the actual training best_validation_accuracy = 0.0 for epoch in range(epochs): + loss = 0 + wandb.log({'epoch': epoch, 'loss': loss}) for minibatch_index in range(num_training_batches): iteration = num_training_batches*epoch+minibatch_index if iteration % 1000 == 0: @@ -179,6 +187,8 @@ def SGD(self, training_data, epochs, mini_batch_size, eta, print("Best validation accuracy of {0:.2%} obtained at iteration {1}".format( best_validation_accuracy, best_iteration)) print("Corresponding test accuracy of {0:.2%}".format(test_accuracy)) + wandb.save("mymodel.h5") + #### Define layer types diff --git a/test.py b/test.py index d1f4996..809275c 100644 --- a/test.py +++ b/test.py @@ -207,4 +207,4 @@ def testTheano(): activation_fn=ReLU), FullyConnectedLayer(n_in=40*4*4, n_out=100, activation_fn=ReLU), SoftmaxLayer(n_in=100, n_out=10)], mini_batch_size) -net.SGD(training_data, 60, mini_batch_size, 0.03, validation_data, test_data, lmbda=0.1) +net.SGD(training_data, 1, mini_batch_size, 0.03, validation_data, test_data, lmbda=0.1)