Neural Net Functions

 

Introduction

The sections which follow, describe all of the functions, methods, and global variables which operate upon or are specifically related to the Neural Net Object type. Each function, method, and global variable has its own section. The sections are listed in alphabetic order.

clear

Overview                    

The clear Method resets the specified NeuralNet object and randomizes all of the weights at each level of the net.  Alternatively, the clear method may reset all of the weights to those specified in the weights vector supplied as an argument.

 

Type:              Method

 

Syntax:            (clear:aNeuralNet)

Syntax:            (clear:aNeuralNet  seed)

Syntax:            (clear:aNeuralNet  weightsVector)

 

When To Use              

The clear method is used to reset a NeuralNet object and randomize its weights.

 

__________________________________________________________________

Arguments                               Explanation                                                                                                                    

aNeuralNet

The NeuralNet Object to be cleared

Returns

The NeuralNet Object cleared

__________________________________________________________________

 

Example1                    

...to be continued...

 

When To Use              

The clear method is used to reset a NeuralNet object and pseudo randomize its weights.

 

__________________________________________________________________

Arguments                               Explanation                                                                                                                    

aNeuralNet

The NeuralNet Object to be cleared

seed

The seed for the srandom function to be set before pseudo randomizing the weights.

Returns

The NeuralNet Object cleared

__________________________________________________________________

 

Example1                    

...to be continued...

 

When To Use              

The clear method is used to reset the weights in a NeuralNet object to those values contained in the  specified weights vector. The weights vector would have been obtained from a previous getWeights method.

 

__________________________________________________________________

Arguments                               Explanation                                                                                                                    

aNeuralNet

The NeuralNet Object to be cleared

weightsVector

The vector containing the new weights for this NeuralNet.

Returns

The NeuralNet Object has all its weights reset.

__________________________________________________________________

 

Example1                    

...to be continued...

computeError

Overview                    

The computeError Method computes the output error for the specified NeuralNet {aNeuralNet}. The output signal is compared to the specified target {target}, and the resulting least squares error is computed and placed in the error property of the NeuralNet.

The target must be a Number Vector of the same length or larger than specified in the previous makeNeuralNet (if larger, the target signals are taken from the right of the target vector). The output error is computed and placed in the error property of the NeuralNet. This method does NOT adjust weights in each hidden layer of the NeuralNet.

 

Type:              Method

 

Syntax:            (computeError:aNeuralNet  target)

 

When To Use              

The computeError method is used to compute the error.

 

__________________________________________________________________

Arguments                               Explanation                 

aNeuralNet

The NeuralNet whose input signal is to be propagated.

target

The target vector to be compared with the output signal.

Returns

The Object Identifier of the new NeuralLayer Object

__________________________________________________________________

 

Example1                    

(setq  aNN  (makeNeuralNet  6  1  binary:))

(clear:aNN)

(setq  in  (makeVector  number:  6  .2  .1  .3  .5  .7  .22))

(setq  target  (makeVector  number:  1 32))

(propagateForward:aNN  in)

(setq error (computeError:aNN  target))                   

Note1   The returned error is the sum of the squared errors for each output signal.           

Note2   Input must be within the closed interval [0, 1].

getWeights

Overview                    

The getWeights Method returns the weights of the specified NeuralNet object. The clear method may then be used later to reset all of the weights to those specified in the specified weights vector. In effect, the getWeights method saves the state of the NeuralNet object at that time.

 

Type:              Method

 

Syntax:            (getWeights:aNeuralNet)

 

When To Use              

The getWeights method is used to save the sate of a NeuralNet object for later use.

 

__________________________________________________________________

Arguments                               Explanation                                                                                                                    

aNeuralNet

The NeuralNet Object whose state is to be saved

Returns

The weightsVector containing the weights of the NeuralNet object

__________________________________________________________________

 

Example1                    

...to be continued...

makeNeuralNet

Overview                    

The  makeNeuralNet Function creates a new NeuralNet object complete with all child NeuralLayer objects required. The makeNeuralNet function provides a time-saving short cut as opposed to using the (new NeuralNet: ) function call for the outer object and the (new NeuralLayer: ) function call for each of the input, hidden layer, and output neural layers.

 

Type:              Function

 

Syntax:            (makeNeuralNet  inputs outputs filter)

Syntax:            (makeNeuralNet  inputs hidden outputs filter)

Syntax:            (makeNeuralNet  weightsVector)

 

When To Use              

The makeNeuralNet function is used to create a NeuralNet object easily. The number of hidden layer neurons is automatically set to (2 x inputs) + 1. This is the minimum number which allows the neural net to recognize any continuous function with the specified number of inputs.

 

__________________________________________________________________

Arguments                               Explanation                                                                                                                    

inputs

The number of cells in the input layer

output

The number of cells in the output layer .

filter

Must be one of the following valid output filter functions:

continuous:  Continuous unrestricted real number output

sigmoid:       Continuous output restricted within [0, 1]

binary:          Binary output (either 0 or 1)

bipolar:         Bipolar output (either -1 or 1)

The default is  continuous:

The filter symbol identifies the output function used to determine the final output value from the NeuralNet object.

Returns

The Object Identifier of the new NeuralNet Object

__________________________________________________________________

 

Example1                    

...to be continued...

 

When To Use              

The makeNeuralNet function is used to create a NeuralNet object easily. The number of hidden layer neurons is specified by the user.

 

__________________________________________________________________

Arguments                               Explanation                                                                                                                    

inputs

The number of cells in the input layer

hidden

The number of cells in the hidden layer

output

The number of cells in the output layer .

filter

Must be one of the following valid output filter functions:

continuous:  Continuous unrestricted real number output

sigmoid:       Continuous output restricted within [0, 1]

binary:          Binary output (either 0 or 1)

bipolar:         Bipolar output (either -1 or 1)

The default is  continuous:

The filter symbol identifies the output function used to determine the final output value from the NeuralNet object.

Returns

The Object Identifier of the new NeuralNet Object

__________________________________________________________________

 

Example1                    

...to be continued...

 

 

When To Use              

The makeNeuralNet function is used to recreate a NeuralNet object from the weightsVector returned from a previous getWeights method.

 

__________________________________________________________________

Arguments                               Explanation                                                                                                                    

weightsVector

The weightsVector returned from a previous getWeights method.

Returns

The recreated NeuralNet Object

__________________________________________________________________

 

Example1                    

...to be continued...

propagateBackward

Overview                    

The propagateBackward Method propagates the output error for the specified NeuralNet {aNeuralNet}. The output signal is compared to the specified target {target}, and the resulting least squares error is propagated backward through each layer of the NeuralNet.

The target must be a Number Vector of the same length or larger than specified in the previous makeNeuralNet (if larger, the target signals are taken from the right of the target vector). The output error is propagated backward through the hidden layer finally producing adjusted weights in each layer of the NeuralNet.

 

Type:              Method

 

Syntax:            (propagateBackward:aNeuralNet  target)

 

When To Use              

The propagateBackward method is used to produce adjusted weights in the NeuralNet's layers.

 

__________________________________________________________________

Arguments                               Explanation                 

aNeuralNet

The NeuralNet whose input signal is to be propagated.

target

The target vector to be compared with the output signal.

Returns

The Object Identifier of the new NeuralLayer Object

__________________________________________________________________

 

Example1                    

(setq  aNN  (makeNeuralNet  6  1  binary:))

(clear:aNN)

(setq  in  (makeVector  number:  6  .2  .1  .3  .5  .7  .22))

(setq  target  (makeVector  number:  1 32))

(propagateForward:aNN  in)

(propagateBackward:aNN  target)                 

Note     Input must be within the closed interval [0, 1]. 

propogateForward

Overview                    

The propagateForward method propagates an input signal {inVector} forward in the specified neural net {aNeuralNet}.  The input signal must be a Number Vector of the same length as specified in the previous makeNeuralNet. If the input signal is omitted, the current values in the input layer (aNeuralNet.input.output) are used as the input signal. The input signal is propagated forward through the hidden layer and producing new values in the output layer.

 

Type:              Method

 

Syntax:            (propagateForward:aNeuralNet  inVector)

(propagateForward:aNeuralNet)

 

When To Use              

The propagateForward method is used to produce new values in the NeuralNet's output layer.

 

__________________________________________________________________

Arguments                               Explanation                                                                                                                    

aNeuralNet

The NeuralNet whose input signal is to be propagated.

inVector

Optional Argument .  The input signal to be propagated.

Returns

Propagates the input signal forward through the hidden layer producing new values and returns the Object Identifier of the NeuralNet Object.

__________________________________________________________________

 

Example1                    

(setq  aNN  (makeNeuralNet  6  1  continuous:))

(clear:aNN)

(setq  in  (makeVector  number:  6  .2  .1  .3  .5  .7  .22))

(propagateForward:aNN  in)   

 

Note     Input must be within the closed interval [0, 1].

propagateUserError

Overview                    

The propagateUserError Method propagates the user error for the specified NeuralNet {aNeuralNet}. The output signal is assigned the specified user error {target}, and the resulting user supplied error is propagated backward through each layer of the NeuralNet.

The final error value is the sum of the squares of each user supplied error signal {target}. Each user supplied error signal should be positive (if the current output should be moved higher) or negative (if the current output should be moved lower). The magnitude of the error signal determines the magnitude of the output signal adjustment.

The target must be a Number Vector of the same length or larger than specified in the previous makeNeuralNet (if larger, the errors are taken from the right of the error vector). The user error is propagated backward through the hidden layer finally producing adjusted weights in each layer of the NeuralNet.

 

Type:              Method

 

Syntax:            (propagateUserError:aNeuralNet  target)

 

When To Use              

The propagateUserError method is used to produce adjusted weights in the NeuralNet's layers.

 

__________________________________________________________________

Arguments                               Explanation                 

aNeuralNet

The NeuralNet whose input signal is to be propagated.

target

The target vector to assign user errors to each output signal.

Returns

The Object Identifier of the new NeuralLayer Object

__________________________________________________________________

 

Example1                    

(setq  aNN  (makeNeuralNet  6  1  binary:))

(clear:aNN)

(setq  in  (makeVector  number:  6  .2  .1  .3  .5  .7  .22))

(setq  target  (makeVector  number:  1 32))

(propagateForward:aNN  in)

(propagateUserError:aNN  target)