Package: netpy
# NetPy[![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://github.com/maclinchy/netpy/blob/master/LICENSE)## Installation### We recommended to install NetPy in virtual env.To get started, you should install ```virtualenv``` tool with ```pip```.```shpip install virtualenv```New directory to work with:```shmkdir python-virtual-environments && cd python-virtual-environments```Create a new virtual environment inside the directory:```shpython -m venv netpy_env```You need to "activate" it.```shsource netpy_env/bin/activate```If your system is windows:```shnetpy_env\Scripts\activate```Then you need to install NetPy. There is two ways to install:- **Install NetPy from PyPI (recommended):**```shsudo pip install netpy```- **Install NetPy from GitHub source:**```shgit clone https://github.com/maclinchy/netpy.gitcd netpysudo python setup.py install```------------------## Getting startedLet's create the net:```shnhm newnet myFirstNet````netpy-manager` will create folder `myFirstNet`, which contains a directory structure similar to this:```sh├── data_set│   ├── data_X.txt│   └── data_Y.txt├── net_data│   └── arch.json├── conf.json├── network.py├── test.py└── train.py````data_set` is folder which contains data for learning.`net_data` is folder which contains data about our net.`conf.json` is file with settings.`network.py` is main file for init the net.`train.py` is file for train the net`test.py` is file for test the net.Let's create net with 3 layers.------------------`network.py````pythonfrom netpy.nets import FeedForwardNetfrom netpy.modules import LinearLayer,SigmoidLayer, FullRelationfrom netpy.teachers import BackPropTeacherimport numpy as np# Import file with settingsimport confnet = FeedForwardNet()# Add your layers hereinput_layer = LinearLayer()hidden_layer = SigmoidLayer()output_layer = SigmoidLayer()# Add your layers to the net herenet.add_Input_Layer(input_layer)net.add_Layer(hidden_layer)net.add_Output_Layer(output_layer)# Add your connections hererel_in_hid = FullRelation(input_layer, hidden_layer)rel_hid_out = FullRelation(hidden_layer, output_layer)# Add your connections to the net herenet.add_Relation(rel_in_hid)net.add_Relation(rel_hid_out)````train.py````pythonfrom netpy.teachers import BackPropTeacherfrom network import netimport numpy as npimport confnum_of_epoch = 8# Your data settrain_X = np.loadtxt(conf.data_set_dir_X)train_Y = np.loadtxt(conf.data_set_dir_Y)# Config your teacherteacher = BackPropTeacher(net,error = 'MSE',learning_rate = 1e-5,alpha = 0.0001)# Teach your net hereteacher.train(X, Y, num_of_epoch, load_data = False)````test.py````pythonfrom network import nettest = []net.load()print(net.forward(test))```We need to add neurons to the net:```pythoninput_layer = LinearLayer(3)hidden_layer = SigmoidLayer(20)output_layer = SigmoidLayer(1)```Then we need to add the data:`data_X.txt````sh0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1````data_Y.txt````sh00010111```Let's train the net!```shpython train.py```In `net_data` two files - `weights.h5` and `arch.json`.- In `weights.h5` we have save our weights.- In `arch.json` we have save data about the net.- In `myFirstNet.log` we have history of net's actions.If you want to continue learning you should change parameter of train function:```pythonteacher.train(X, Y, 100, load_data = True)```Let's test the net!```shpython test.py````test.py````pythonfrom network import nettest = [0,0,0]net.load()print(net.forward(test))```You can fork your net:```shnhm fork myFirstNet mySecondNet```You can rename your net:```shnhm rename mySecondNet myAwesomeNet```