Orange SNNS module
Orange is a data mining software that is specially good for researching and teaching. It is developed in Python and C++ combining the best from both: interpretability and quick use from Python and efficiency from C++. |
SNNS is a very complete software about artificial neural networks. |
|
OrangeSNNS.py allows using SNNS to create, train and simulate neural networks as learners inside Orange. It is now in the process of development, but near its final state.
Download
There are two versions available.
- OrangeSNNS.py (version 1.09):
- Supports feed-forward, fully-connected multi-layer perceptrons with sigmoid activation function.
- Is simpler than 0.99, as neural networks are evaluated in Python code.
- Does not leak memory.
- Diagram explaining how it works .
- OrangeSNNS.py (version 0.99):
- Is more easily generalizable to all types of neural networks supported by SNNS, as the network code is generated by SNNS.
- Is supposed to be faster, as evaluation of network is .C code instead of Python.
- Is an example of how to dinamicly create, compile and use .C code from Python. Notice that it leaks memory by importing and unimporting modules . (I still don't know if it is a Python or Linux bug, or if I am not doing something necesary to free memory. Let me know if you have some news.) (Note: in the code, it is commented out a workarround that avoids memory leaking, but then, older networks may be used sometimes getting unreliable results)
- You can see its class and function definitions from help(orangeSNNS) .
- Diagram explaining how it works .
Use examples
- exampleOrangeSNNS.py (uses bupa.tab) creates and trains a neural network with default parameters. The network is used to classify the training set showing the predicted class for each example.
import orange, orangeSNNS
data = orange.ExampleTable("bupa.tab")
learner = orangeSNNS.SNNSLearner()
classifier = learner(data)
for example in data:
print example,
print "->", classifier(example)
- exampleOrangeSNNS2.py (uses
bupa.tab) creates and trains a neural network:
- With two hidden layers the first with 2 neurons and the second with 3
- The training process will have 500 cycles on the training set.
- If MSE=0 is achieved training stops.
- The learning algorithm will be standard back propagation.
- The learning parameter is 0.2
The network is then used to classify the training set showing the predicted class for each example.
import orange, orangeSNNS
# We set the path where SNNS binaries can be found, this
# is not necessary if they are in system path.
orangeSNNS.pathSNNS = "~/SNNSv4.2/tools/bin/i686-pc-linux-gnu/"
data = orange.ExampleTable("bupa.tab")
learner = orangeSNNS.SNNSLearner(name = 'SNNS neural network',
hiddenLayers = [2,3],
MSE = 0,
cycles = 500,
algorithm = "Std_Backpropagation",
learningParams = ["0.2"])
classifier = learner(data)
for example in data:
print example,
print "->", classifier(example)
Future plans
There will not be a 2.0 version, as this is just a quick solution. Instead, a completely integrated module with new code should be written, as SNNS is NOT free software and could not be adapted. More efforts on this module are worthless.
Probably a good choice to integrate neural networks in Orange is programming an interface to FANN .
There is a summer of code 2006 project (Neural Nets in SciPy) that may be interesting having an eye on it.