Enum fann::ActivationFunc [] [src]

pub enum ActivationFunc {
    Linear,
    Threshold,
    ThresholdSymmetric,
    Sigmoid,
    SigmoidStepwise,
    SigmoidSymmetric,
    SigmoidSymmetricStepwise,
    Gaussian,
    GaussianSymmetric,
    GaussianStepwise,
    Elliott,
    ElliottSymmetric,
    LinearPiece,
    LinearPieceSymmetric,
    SinSymmetric,
    CosSymmetric,
    Sin,
    Cos,
}

The activation functions used for the neurons during training. They can either be set for a group of neurons using set_activation_func_hidden and set_activation_func_output, or for a single neuron using set_activation_func.

Similarly, the steepness of an activation function is specified using set_activation_steepness_hidden, set_activation_steepness_output and set_activation_steepness.

In the descriptions of the functions:

  • x is the input to the activation function,

  • y is the output,

  • s is the steepness and

  • d is the derivation.

Variants

Linear activation function.

  • span: -inf < y < inf

  • y = x*s, d = 1*s

  • Can NOT be used in fixed point.

Threshold activation function.

  • x < 0 -> y = 0, x >= 0 -> y = 1

  • Can NOT be used during training.

Threshold activation function.

  • x < 0 -> y = 0, x >= 0 -> y = 1

  • Can NOT be used during training.

Sigmoid activation function.

  • One of the most used activation functions.

  • span: 0 < y < 1

  • y = 1/(1 + exp(-2*s*x))

  • d = 2*s*y*(1 - y)

Stepwise linear approximation to sigmoid.

  • Faster than sigmoid but a bit less precise.

Symmetric sigmoid activation function, aka. tanh.

  • One of the most used activation functions.

  • span: -1 < y < 1

  • y = tanh(s*x) = 2/(1 + exp(-2*s*x)) - 1

  • d = s*(1-(y*y))

Stepwise linear approximation to symmetric sigmoid.

  • Faster than symmetric sigmoid but a bit less precise.

Gaussian activation function.

  • 0 when x = -inf, 1 when x = 0 and 0 when x = inf

  • span: 0 < y < 1

  • y = exp(-x*s*x*s)

  • d = -2*x*s*y*s

Symmetric gaussian activation function.

  • -1 when x = -inf, 1 when x = 0 and 0 when x = inf

  • span: -1 < y < 1

  • y = exp(-x*s*x*s)*2-1

  • d = -2*x*s*(y+1)*s

Stepwise linear approximation to gaussian. Faster than gaussian but a bit less precise. NOT implemented yet.

Fast (sigmoid like) activation function defined by David Elliott

  • span: 0 < y < 1

  • y = ((x*s) / 2) / (1 + |x*s|) + 0.5

  • d = s*1/(2*(1+|x*s|)*(1+|x*s|))

Fast (symmetric sigmoid like) activation function defined by David Elliott

  • span: -1 < y < 1

  • y = (x*s) / (1 + |x*s|)

  • d = s*1/((1+|x*s|)*(1+|x*s|))

Bounded linear activation function.

  • span: 0 <= y <= 1

  • y = x*s, d = 1*s

Bounded linear activation function.

  • span: -1 <= y <= 1

  • y = x*s, d = 1*s

Periodical sine activation function.

  • span: -1 <= y <= 1

  • y = sin(x*s)

  • d = s*cos(x*s)

Periodical cosine activation function.

  • span: -1 <= y <= 1

  • y = cos(x*s)

  • d = s*-sin(x*s)

Periodical sine activation function.

  • span: 0 <= y <= 1

  • y = sin(x*s)/2+0.5

  • d = s*cos(x*s)/2

Periodical cosine activation function.

  • span: 0 <= y <= 1

  • y = cos(x*s)/2+0.5

  • d = s*-sin(x*s)/2

Methods

impl ActivationFunc
[src]

Create an ActivationFunc from a fann_sys::fann_activationfunc_enum.

Return the fann_sys::fann_activationfunc_enum corresponding to this ActivationFunc.

Trait Implementations

impl Copy for ActivationFunc
[src]

impl Clone for ActivationFunc
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for ActivationFunc
[src]

Formats the value using the given formatter.

impl Eq for ActivationFunc
[src]

impl PartialEq for ActivationFunc
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.