License |
Language |
AppVeyor |
Travis CI |
Coveralls |
---|---|---|---|---|
Linux:
$ git clone https://github.com/YuriyLisovskiy/NeuralNetwork.git
$ cd NeuralNetwork/
$ virtualenv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
Windows:
$ git clone https://github.com/YuriyLisovskiy/NeuralNetwork.git
$ cd NeuralNetwork/
$ virtualenv venv
$ venv/Scripts/activate
$ pip install -r requirements.txt
Run demo:
$ python runner.py test
- From
neural_network
package import network:from neural_network.network.net import NeuralNetwork
- Create training data for training neural network, example:
training_data = [ ([0, 0, 0], 0), ([0, 0, 1], 1), ([0, 1, 0], 0), ([0, 1, 1], 0), ([1, 0, 0], 1), ([1, 0, 1], 1), ([1, 1, 0], 0), ([1, 1, 1], 1) ]
- Create new neural network using
config/config.py
or custom parameters, example:INPUT_LAYER = [3] HIDDEN_LAYERS = [5, 4, 2] OUTPUT_LAYER = [1] ITERATIONS = 10000 LEARNING_RATE = 0.007
new_net = NeuralNetwork( input_layer=INPUT_LAYER, hidden_layers=HIDDEN_LAYERS, output_layer=OUTPUT_LAYER, learning_rate=LEARNING_RATE, log=False )
- Train the network:
new_net.train( data=training_data, iterations=ITERATIONS, log=False )
- Now network is ready to work, example:
def get_prediction(input_data): result = new_net.predict(input_data) return result >= 0.5
if __name__ == '__main__': print(get_prediction([0, 1, 0]))
This project is licensed under the BSD-2-Clause License - see the LICENSE file for details.