This repository has been archived on 2020-04-25. You can view files and clone it, but cannot push or open issues or pull requests.
ml/nn/testnn.py

13 lines
282 B
Python
Raw Normal View History

2020-02-23 14:14:06 +00:00
#!/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))