|
Documentation
Class and function definitions from help(orangeSNNS).
Artificial neural networks for Orange.
Orange module to add artificial neural networks as learning
algorithms using calls to SNNS software.
Version: 0.97 (working but some more testing and refinements are needed)
SNNS randomness agrees with Orange behaviour on randomness:
http://www.ailab.si/orange/doc/reference/random.htm
In spite of the communicating media with SNNS being files, this code
is supposed to be reentrant. Any way, as some of the temporal files
are named by the module, but created by SNNS, there is a really
small (XXX eng:minuscula) chance of files becoming corrupted and
breaking. Don't worry you would probably win the lotto and hang a
windows program a billion times before this happens.
TO DO: marked XXX in code, check removal of all tmp files,
error handlying in system calls,
error handling when SNNS fails, avoid configuring if SNNS is in PATH
Copyright (C) 2005 Antonio Arauzo Azofra
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Classes |
| |
- SNNSClassifier
- SNNSLearner_Class
class SNNSLearner_Class |
|
Artificial Neural Network(ANN) learner class that uses SNNS to
create and train the ANN. |
|
Methods defined here:
- __call__(self, t, weight=None)
- __init__(self, name='SNNS neural network', hiddenLayers=None, MSE=0, cycles=200, auto=False, nRepeat=3, step=50, percentTrain=0.90000000000000002, algorithm=None, learningParams=None)
- Initializes a new neural network learner, defining the
structure of the networks and training parameters.
By now the structure is a multilayered perceptron
name = learner name
hiddenLayers = a list with the number of nodes of each hidden layer
MSE = stop training if mse is smaller than this value
cycles = stop training after this number of cycles
auto = Whether trainNN (False) or trainAutoNN (True) is used
nRepeat = if auto, the number of times the net is trained
step = if auto, the number of cycles between one test and the next one
percentTrain = if auto, the proportion of patterns used for training
algorithm = name of training algorithm as identified in SNNS
learningParams = list of strings with the parameters as in SNNS
| |
Functions |
| |
- SNNSLearner(examples=None, **kwds)
- createNN(nInputs, hiddenLayers, nOutputs)
- Creates a snns file with the topology of a multilayer
completely connected aNN.
Caller is responsible for deleting network file
Returns: name of the file
- getNoInputsOutputs(transform, domain)
- Gets the number of inputs and outputs from a transformation
description from savePatFile
- inverseTransformClassAttribute(out, transform, domain)
- From a NN output get the class by: majority criterion, or
denormalizing in continuous cases.
Returns: orange.Value with the class
- nn2module(nnFileName, nOutputs)
- Creates a new python module with a funcion "eval" that calls the trained
artificial neural network
Caller is responsible for deleting module file and directory.
Returns: the complete pathname of the new module
- savePatFile(table)
- Given an orange example table create an SNNS pattern file.
Transform data:
Normalize continuous data to [0,1].
Discrete values to N inputs/outputs in {0,1}
Details of the transformation performed (transform):
[(Continuous=True, pos, width),(Continuous=False, no.values)]
Caller is responsible for deleting pat file
Returns: (patternFileName, transform)
- trainAutoNN(nnFileName, trainFileName, testFileName, MSE, cycles, nRepeat, step, algorithm, learningParams)
- Trains a neural network using batchman. Uses test data to evaluate
the training state and select the best neural network.
- trainNN(nnFileName, patternFileName, MSE, cycles, algorithm, learningParams)
- Trains a neural network using batchman
- transformExampleAttributes(example, transform, domain)
- Applies a defined trasformation (as given by savePatFile) to
the non class part of an individual example
Returns: a list with the result
|
|