13 lines
282 B
Python
13 lines
282 B
Python
|
#!/usr/bin/env python3
|
||
|
# coding: utf-8
|
||
|
import neuralNetwork as nn
|
||
|
import numpy as np
|
||
|
|
||
|
n = nn.NeuralNetwork([2, 2, 1], 'tanh')
|
||
|
|
||
|
x = np.array([[0, 0], [0, 1], [1, 0], [1, 1]])
|
||
|
y = np.array([0, 1, 1, 0])
|
||
|
n.fit(x, y)
|
||
|
for i in [[0, 0], [0, 1], [1, 0], [1, 1]]:
|
||
|
print(i, n.predit(i))
|