From 2a26d2937c2412c5ece5d26587a7351dcb226b67 Mon Sep 17 00:00:00 2001 From: pa-m Date: Tue, 4 Apr 2017 19:39:27 +0200 Subject: [PATCH 1/5] Avoid ImportError: cannot import name 'downsample' Since a change in theano 0.9 downsample.max_pool_2d has to be replaced with pool.pool_2d. --- network3.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/network3.py b/network3.py index 2ae74e0..ff8afa8 100644 --- a/network3.py +++ b/network3.py @@ -39,7 +39,7 @@ from theano.tensor.nnet import conv from theano.tensor.nnet import softmax from theano.tensor import shared_randomstreams -from theano.tensor.signal import downsample +from theano.tensor.signal.pool import pool_2d # Activation functions for neurons def linear(z): return z @@ -227,8 +227,8 @@ def set_inpt(self, inpt, inpt_dropout, mini_batch_size): conv_out = conv.conv2d( input=self.inpt, filters=self.w, filter_shape=self.filter_shape, image_shape=self.image_shape) - pooled_out = downsample.max_pool_2d( - input=conv_out, ds=self.poolsize, ignore_border=True) + pooled_out = pool_2d( + input=conv_out, ws=self.poolsize, ignore_border=True) self.output = self.activation_fn( pooled_out + self.b.dimshuffle('x', 0, 'x', 'x')) self.output_dropout = self.output # no dropout in the convolutional layers From ce2c044fb2b85371d65b4c71ab08b3bed9ba8067 Mon Sep 17 00:00:00 2001 From: Dane Date: Fri, 2 Mar 2018 01:42:31 -0500 Subject: [PATCH 2/5] Small update for Python 3 Changed two print statements to print functions to be compatible with Python 3 instead of Python 2. --- mnist_svm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mnist_svm.py b/mnist_svm.py index fb24949..92ff363 100644 --- a/mnist_svm.py +++ b/mnist_svm.py @@ -20,8 +20,8 @@ def svm_baseline(): # test predictions = [int(a) for a in clf.predict(test_data[0])] num_correct = sum(int(a == y) for a, y in zip(predictions, test_data[1])) - print "Baseline classifier using an SVM." - print "%s of %s values correct." % (num_correct, len(test_data[1])) + print("Baseline classifier using an SVM.") + print(num_correct + " of " + len(test_data[1]) + " values correct.") if __name__ == "__main__": svm_baseline() From 998e51b741e95c2e6fd18cdba7df0c9b94e7957f Mon Sep 17 00:00:00 2001 From: Dane Date: Fri, 2 Mar 2018 17:04:26 -0500 Subject: [PATCH 3/5] Add str() to variables being printed I realized that the variables weren't strings despite having "%s" (I thought the "s" meant string) in Python 2. That is what you get for only dealing with Python 3. :P --- mnist_svm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mnist_svm.py b/mnist_svm.py index 92ff363..c2650e9 100644 --- a/mnist_svm.py +++ b/mnist_svm.py @@ -21,7 +21,7 @@ def svm_baseline(): predictions = [int(a) for a in clf.predict(test_data[0])] num_correct = sum(int(a == y) for a, y in zip(predictions, test_data[1])) print("Baseline classifier using an SVM.") - print(num_correct + " of " + len(test_data[1]) + " values correct.") + print(str(num_correct) + " of " + str(len(test_data[1])) + " values correct.") if __name__ == "__main__": svm_baseline() From 11cd4c1643c39ada6a97b93dc2c522a3b59095ac Mon Sep 17 00:00:00 2001 From: Hamolicious <56944714+hamolicious@users.noreply.github.com> Date: Fri, 23 Oct 2020 13:12:15 +0100 Subject: [PATCH 4/5] Update network.py - Removed semicolon line:73 --- network.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/network.py b/network.py index ad9f26e..78629cf 100644 --- a/network.py +++ b/network.py @@ -70,7 +70,7 @@ def SGD(self, training_data, epochs, mini_batch_size, eta, for mini_batch in mini_batches: self.update_mini_batch(mini_batch, eta) if test_data: - print("Epoch {} : {} / {}".format(j,self.evaluate(test_data),n_test)); + print("Epoch {} : {} / {}".format(j,self.evaluate(test_data),n_test)) else: print("Epoch {} complete".format(j)) From 2da41b6dd19dafae92db1facbc4ed19738e80551 Mon Sep 17 00:00:00 2001 From: michaldobrzanski Date: Mon, 27 Nov 2023 14:07:08 +0100 Subject: [PATCH 5/5] added MIT license --- LICENSE.md | 21 +++++++++++++++++++++ README.md | 3 +++ 2 files changed, 24 insertions(+) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..7cdd5a8 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Michał Dobrzański + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index aa618b0..fca1612 100644 --- a/README.md +++ b/README.md @@ -10,4 +10,7 @@ The testing file (**test.py**) contains all three networks (network.py, network2 In test.py there are examples of networks configurations with proper comments. I did that to relate with particular chapters from the book. +### License +Disributed under MIT License. [Link](LICENSE.md). +