Interface module to use artificial neural networks from SNNS software as learning algoritms in Orange.
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.
Download
There are two versions available.
- OrangeSNNS.py(version 1.09):
- Supports feed-forward, fully-connected multi-layer perceptrons with sigmoidactivation function.
- Is simpler than 0.99, as neural networks are evaluated in Python code.
- Does not leak memory.
- 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) .
Use examples
- Create and train a neural network with default parameters (using bupa.tab as data). 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)
- Create and train 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 (using bupa.tab as data).
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.

