cc.glsn.v15.neuralnet
Class SigmoidFunction

java.lang.Object
  extended by cc.glsn.v15.neuralnet.SigmoidFunction
All Implemented Interfaces:
NetFunction, Serializable

public class SigmoidFunction
extends Object
implements NetFunction

Implementation of the sigmoid function for neural network activation. This is a common function to use for neural networks and recommended if you don't know which one to pick. Note: the sigmoid function can only return between 0 and 1. And near the edges of that, it takes an extreme input to get that. I may be doing something majorly wrong, but I'd recommend expecting outputs in the area of 0.25 - 0.75. If you are expecting boolean outputs, I'd do 0.25 = false, 0.75 = true or something like that. If you are expecting floating point output, I'd map the things you care about to 0.25-0.75 range. This seems to work well for me, but I'm no expert in neural networks or maths.

  • g(x)= 1/(1+e^(-x))
  • g'(x) = g(x) * (1 - g(x))

    See Also:
    Serialized Form

    Constructor Summary
    SigmoidFunction()
               
     
    Method Summary
     double functionG(double x)
              get output for input of x
     double functionGprime(double x)
              get derivitive of function for input x used for back propogation learning
     
    Methods inherited from class java.lang.Object
    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    SigmoidFunction

    public SigmoidFunction()
    Method Detail

    functionG

    public double functionG(double x)
    Description copied from interface: NetFunction
    get output for input of x

    Specified by:
    functionG in interface NetFunction
    Parameters:
    x - - input
    Returns:
    value - g'(x)

    functionGprime

    public double functionGprime(double x)
    Description copied from interface: NetFunction
    get derivitive of function for input x used for back propogation learning

    Specified by:
    functionGprime in interface NetFunction
    Parameters:
    x - - input
    Returns:
    derivitive - g'(x)