mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-03-27 17:06:44 +00:00
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:
parent
4658f4a49e
commit
c2e8582abd
@ -26,6 +26,7 @@ script:
|
|||||||
linear_algebra_python
|
linear_algebra_python
|
||||||
matrix
|
matrix
|
||||||
networking_flow
|
networking_flow
|
||||||
|
neural_network
|
||||||
other
|
other
|
||||||
project_euler
|
project_euler
|
||||||
searches
|
searches
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
Perceptron
|
Perceptron
|
||||||
w = w + N * (d(k) - y) * x(k)
|
w = w + N * (d(k) - y) * x(k)
|
||||||
|
|
||||||
Using perceptron network for oil analysis,
|
Using perceptron network for oil analysis,
|
||||||
with Measuring of 3 parameters that represent chemical characteristics we can classify the oil, in p1 or p2
|
with Measuring of 3 parameters that represent chemical characteristics we can classify the oil, in p1 or p2
|
||||||
p1 = -1
|
p1 = -1
|
||||||
p2 = 1
|
p2 = 1
|
||||||
|
|
||||||
'''
|
'''
|
||||||
from __future__ import print_function
|
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]
|
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:
|
while True:
|
||||||
sample = []
|
sample = []
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
sample.insert(i, float(input('value: ')))
|
sample.insert(i, float(input('value: ').strip()))
|
||||||
network.sort(sample)
|
network.sort(sample)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user