Skip to main content

Simple and powerfull neural network library for python

Project description

******************* Introduction ***************

NeuroLab - a library of basic nueral networks algorithms with flexible network configurations and learning algorithms. To simplify migration, the syntax of the library is as close to a package of Neural Network Toolbox (NNT) of MATLAB (c). The library is based on the package numpy (http://numpy.scipy.org), some learning algorithms are used scipy.optymyze (http://scipy.org).

Create network:
>>> import neurolab as nl
>>> # create feed forward multilayer perceptron
>>> net = nl.net.newff([[0, 0.5], [0, 0.5]], [3,1])

Created two-layer network(3-1) with 2-inputs and one output. Input layer contains 3 neurons, the output 1 neuron. Input range: 0.0, 0.5

Train:
>>> # Create learning samples
>>> input = [[0.1, 0.1],
...          [0.1, 0.2],
...          [0.1, 0.3],
...          [0.1, 0.4],
...          [0.2, 0.2],
...          [0.2, 0.3],
...          [0.2, 0.4],
...          [0.3, 0.3],
...          [0.3, 0.4],
...          [0.4, 0.4]]
>>>
>>> target = [[i[0] + i[1]] for i in input]
>>> # Train
>>> error = net.train(input, target, epochs=500, goal=0.1)
Train error:
>>> print "Finish error:", error[-1]
Finish error: 0.125232586274
Simulate:
>>> net.sim([[0.1, 0.5], [0.3, 0. 1]])
array([[ 0.59650825],
   [ 0.41686071]])
Network Info:
>>> # Number of network inputs:
>>> net.ci
2
>>> # Number of network outputs:
>>> net.co
1
>>> # Number of network layers:
>>> len(net.layers)
2
>>> # Weight of first neuron of input layer (net.layers[0])
>>> net.layers[0].np['w'][1]
array([-0.67211163, -0.87277918])
>>>
>>> # Bias output layer:
>>> net.layers[-1].np['b']
array([-0.69717423])
>>> # Train params
>>> net.train.defaults
{'goal': 0.01,
 'show': 100,
 'epochs': 1000,
 'lr': 0.01,
 'adapt': False,
 'errorf': <neurolab.error.SSE instance at 0x03757EB8>}
Save/Load:
>>> net.save('sum.net')
>>> newnet = nl.load('sum.net')
Change train function:
>>> net.trainf = nl.train.TrainCG()
>>> # Change error function:
>>> net.trainf.defaunts['trainf'] = nl.error.SAE()
Change transfer function on output layer:
>>> net.layers[-1].transf = nl.trans.HardLim()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neurolab-0.0.4.zip (276.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neurolab-0.0.4.win32.exe (211.5 kB view details)

Uploaded Source

File details

Details for the file neurolab-0.0.4.zip.

File metadata

  • Download URL: neurolab-0.0.4.zip
  • Upload date:
  • Size: 276.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for neurolab-0.0.4.zip
Algorithm Hash digest
SHA256 12fc0063a4221aa846dcd73e69b91a0d0e580bc18e4b21f34857c1170a4a7629
MD5 54acffa752a46bdd96c4cfb89ad97d58
BLAKE2b-256 d12226ccba2834915297b0fd7a48bf29515cc0a6369b8817cafbd61b3a2b8133

See more details on using hashes here.

File details

Details for the file neurolab-0.0.4.win32.exe.

File metadata

  • Download URL: neurolab-0.0.4.win32.exe
  • Upload date:
  • Size: 211.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for neurolab-0.0.4.win32.exe
Algorithm Hash digest
SHA256 8fe58f016419dcefc2518f301f86442b19a05c21ff0e802b0db6773e1d2aab84
MD5 d3d07c8d80e9503349337fcef506d213
BLAKE2b-256 3e1527f4f878c31b7cb59ddf87c09ecfd66f062c490352d7171ca226562ab521

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page