Travis CI: Add pytest --doctest-modules neural_network (#1028)

* neural_network/perceptron.py: Add if __name__ == '__main__':

* Remove tab indentation

* Add neural_network to the pytests
This commit is contained in:
cclauss 2019-07-18 13:10:52 +02:00 committed by GitHub
parent 4658f4a49e
commit c2e8582abd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 13 deletions

View File

@ -26,6 +26,7 @@ script:
linear_algebra_python
matrix
networking_flow
neural_network
other
project_euler
searches

View File

@ -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
@ -113,12 +113,13 @@ samples = [
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)