From e30906a4223f1c977991b063fa4878f31b94a892 Mon Sep 17 00:00:00 2001 From: Harry Slatyer Date: Fri, 9 Dec 2016 16:43:12 +1100 Subject: [PATCH] Tweak some NNI params to perform better on the test --- mloop/nnlearner.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mloop/nnlearner.py b/mloop/nnlearner.py index 14b612e..10dad2d 100644 --- a/mloop/nnlearner.py +++ b/mloop/nnlearner.py @@ -71,7 +71,7 @@ def _create_neural_net(self): tf.reduce_mean(tf.reduce_sum(tf.square(self.output_var - self.output_placeholder), reduction_indices=[1])) + self.regularisation_coefficient * sum([tf.nn.l2_loss(W) for W in self.weights])) - self.train_step = tf.train.AdamOptimizer().minimize(loss_func) + self.train_step = tf.train.AdamOptimizer(1.0).minimize(loss_func) self.tf_session.run(tf.initialize_all_variables()) @@ -104,7 +104,9 @@ def fit_neural_net(self, all_params, all_costs): batch_output = [[all_costs[index]] for index in batch_indices] self.tf_session.run(self.train_step, feed_dict={self.input_placeholder: batch_input, - self.output_placeholder: batch_output}) + self.output_placeholder: batch_output, + self.regularisation_coefficient: 0.01, + }) def predict_cost(self,params): '''