Neural Network Software

com.practicalstudies.neural
Class LogisticFunction

java.lang.Object
  |
  +--com.practicalstudies.neural.LogisticFunction
All Implemented Interfaces:
ActivationFunction, ErrorFunction

public class LogisticFunction
extends java.lang.Object
implements ActivationFunction, ErrorFunction

Encapsulates the calculation of Node activation or output based on the logistic function, and of the error in output for the backpropagation training method using this function.

The logistic function is a good choice for fitting continuously valued data in the range of 0 to 1.

Activation and error functions are combined in this class given that the error calculation for backpropagation is derived from the activation calculation.

Author:
Michael Wax
See Also:
ActivationFunction, ErrorFunction

Constructor Summary
LogisticFunction()
          Constructor for a function with a threshold of 0 and a steepness of 1.
LogisticFunction(double threshold)
          Constructor for a function with specified threshold and steepness values.
 
Method Summary
 double calculateActivation(double weightedInput)
          Calculates neuron activation as the logistic function 1/(1 + e-(steepness*input-threshold)), which returns values in [0,1], with a value of 0.5 at the value specified by the threshold.
 double calculateError(double calculatedValue, double actualValue)
          Calculate the error in Neuron output relative to an actual value (useful for neurons in an output layer).
 double calculateError(double calculatedValue, java.util.List outputConnections)
          Calculate the error in Neuron output based on errors observed in the outputs of Neurons which rely on the output of this Neuron.
 double getSteepness()
           
 double getThreshold()
           
 void setSteepness(double steepness)
          Specify the steepness parameter of the logistic function.
 void setThreshold(double threshold)
          Specify a threshold value, which determines where the logistic function is centered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogisticFunction

public LogisticFunction()
Constructor for a function with a threshold of 0 and a steepness of 1.

See Also:
setThreshold, setSteepness

LogisticFunction

public LogisticFunction(double threshold)
Constructor for a function with specified threshold and steepness values.

See Also:
setThreshold, setSteepness
Method Detail

getThreshold

public double getThreshold()

setThreshold

public void setThreshold(double threshold)
Specify a threshold value, which determines where the logistic function is centered.


getSteepness

public double getSteepness()

setSteepness

public void setSteepness(double steepness)

Specify the steepness parameter of the logistic function.

A value of one (the default) is typical. Values smaller than one will make the function less steep, and values greater than one more steep. An infinite value would yield a step function.


calculateActivation

public double calculateActivation(double weightedInput)
Calculates neuron activation as the logistic function 1/(1 + e-(steepness*input-threshold)), which returns values in [0,1], with a value of 0.5 at the value specified by the threshold.

Specified by:
calculateActivation in interface ActivationFunction

calculateError

public double calculateError(double calculatedValue,
                             double actualValue)
Calculate the error in Neuron output relative to an actual value (useful for neurons in an output layer).

Specified by:
calculateError in interface ErrorFunction
Parameters:
calculatedValue - the calculated output of the Neuron
actualValue - the expected output of the Neuron

calculateError

public double calculateError(double calculatedValue,
                             java.util.List outputConnections)
Calculate the error in Neuron output based on errors observed in the outputs of Neurons which rely on the output of this Neuron.

Specified by:
calculateError in interface ErrorFunction
Parameters:
calculatedValue - the calculated output of the Neuron
outputConnections - a List of WeightedConnections to Neurons which receive the output of this Neuron

PracticalStudies.com