From 8e4cc3451bef673bc002e64a94ca68d03e809142 Mon Sep 17 00:00:00 2001 From: cclauss Date: Wed, 17 Jul 2019 01:18:44 +0200 Subject: [PATCH 1/3] neural_network/perceptron.py: Add if __name__ == '__main__': --- neural_network/perceptron.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/neural_network/perceptron.py b/neural_network/perceptron.py index eb8b04e855d3..c386fce02044 100644 --- a/neural_network/perceptron.py +++ b/neural_network/perceptron.py @@ -113,12 +113,13 @@ def sign(self, u): exit = [-1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1] -network = Perceptron(sample=samples, exit = exit, learn_rate=0.01, epoch_number=1000, bias=-1) +if __name__ == '__main__': + network = Perceptron(sample=samples, exit = exit, learn_rate=0.01, epoch_number=1000, bias=-1) -network.training() + network.training() -while True: - sample = [] - for i in range(3): - sample.insert(i, float(input('value: '))) - network.sort(sample) + while True: + sample = [] + for i in range(3): + sample.insert(i, float(input('value: ').strip())) + network.sort(sample) From 7f186f2e4be3e33c7a1989d079a87ae420d39cb8 Mon Sep 17 00:00:00 2001 From: cclauss Date: Wed, 17 Jul 2019 01:23:36 +0200 Subject: [PATCH 2/3] Remove tab indentation --- neural_network/perceptron.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/neural_network/perceptron.py b/neural_network/perceptron.py index c386fce02044..787ea8f73bf1 100644 --- a/neural_network/perceptron.py +++ b/neural_network/perceptron.py @@ -1,12 +1,12 @@ ''' - Perceptron - w = w + N * (d(k) - y) * x(k) + Perceptron + w = w + N * (d(k) - y) * x(k) - Using perceptron network for oil analysis, - with Measuring of 3 parameters that represent chemical characteristics we can classify the oil, in p1 or p2 - p1 = -1 - p2 = 1 + Using perceptron network for oil analysis, + with Measuring of 3 parameters that represent chemical characteristics we can classify the oil, in p1 or p2 + p1 = -1 + p2 = 1 ''' from __future__ import print_function From 9b07820aa930a93e960e9284cc5d3f1570785dc8 Mon Sep 17 00:00:00 2001 From: cclauss Date: Wed, 17 Jul 2019 01:24:59 +0200 Subject: [PATCH 3/3] Add neural_network to the pytests --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 3b55045ac33f..407c19643ed9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,7 @@ script: linear_algebra_python matrix networking_flow + neural_network other project_euler searches