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
Linear activation function.
-
span: -inf < y < inf
-
y = xs, d = 1s
-
Can NOT be used in fixed point.
Threshold
Threshold activation function.
-
x < 0 -> y = 0, x >= 0 -> y = 1
-
Can NOT be used during training.
ThresholdSymmetric
Threshold activation function.
-
x < 0 -> y = 0, x >= 0 -> y = 1
-
Can NOT be used during training.
Sigmoid
Sigmoid activation function.
-
One of the most used activation functions.
-
span: 0 < y < 1
-
y = 1/(1 + exp(-2sx))
-
d = 2sy*(1 - y)
SigmoidStepwise
Stepwise linear approximation to sigmoid.
- Faster than sigmoid but a bit less precise.
SigmoidSymmetric
Symmetric sigmoid activation function, aka. tanh.
-
One of the most used activation functions.
-
span: -1 < y < 1
-
y = tanh(sx) = 2/(1 + exp(-2s*x)) - 1
-
d = s*(1-(y*y))
SigmoidSymmetricStepwise
Stepwise linear approximation to symmetric sigmoid.
- Faster than symmetric sigmoid but a bit less precise.
Gaussian
Gaussian activation function.
-
0 when x = -inf, 1 when x = 0 and 0 when x = inf
-
span: 0 < y < 1
-
y = exp(-xsx*s)
-
d = -2xsys
GaussianSymmetric
Symmetric gaussian activation function.
-
-1 when x = -inf, 1 when x = 0 and 0 when x = inf
-
span: -1 < y < 1
-
y = exp(-xsx*s)*2-1
-
d = -2xs*(y+1)*s
GaussianStepwise
Stepwise linear approximation to gaussian. Faster than gaussian but a bit less precise. NOT implemented yet.
Elliott
Fast (sigmoid like) activation function defined by David Elliott
-
span: 0 < y < 1
-
y = ((xs) / 2) / (1 + |xs|) + 0.5
-
d = s1/(2(1+|xs|)(1+|x*s|))
ElliottSymmetric
Fast (symmetric sigmoid like) activation function defined by David Elliott
-
span: -1 < y < 1
-
y = (xs) / (1 + |xs|)
-
d = s1/((1+|xs|)(1+|xs|))
LinearPiece
Bounded linear activation function.
-
span: 0 <= y <= 1
-
y = xs, d = 1s
LinearPieceSymmetric
Bounded linear activation function.
-
span: -1 <= y <= 1
-
y = xs, d = 1s
SinSymmetric
Periodical sine activation function.
-
span: -1 <= y <= 1
-
y = sin(x*s)
-
d = scos(xs)
CosSymmetric
Periodical cosine activation function.
-
span: -1 <= y <= 1
-
y = cos(x*s)
-
d = s*-sin(x*s)
Sin
Periodical sine activation function.
-
span: 0 <= y <= 1
-
y = sin(x*s)/2+0.5
-
d = scos(xs)/2
Cos
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]
impl ActivationFunc
pub fn from_fann_activationfunc_enum(
af_enum: fann_activationfunc_enum
) -> FannResult<ActivationFunc>
[src]
pub fn from_fann_activationfunc_enum(
af_enum: fann_activationfunc_enum
) -> FannResult<ActivationFunc>
Create an ActivationFunc
from a fann_sys::fann_activationfunc_enum
.
pub fn to_fann_activationfunc_enum(self) -> fann_activationfunc_enum
[src]
pub fn to_fann_activationfunc_enum(self) -> fann_activationfunc_enum
Return the fann_sys::fann_activationfunc_enum
corresponding to this ActivationFunc
.
Trait Implementations
impl Copy for ActivationFunc
[src]
impl Copy for ActivationFunc
impl Clone for ActivationFunc
[src]
impl Clone for ActivationFunc
fn clone(&self) -> ActivationFunc
[src]
fn clone(&self) -> ActivationFunc
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for ActivationFunc
[src]
impl Debug for ActivationFunc
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Eq for ActivationFunc
[src]
impl Eq for ActivationFunc
impl PartialEq for ActivationFunc
[src]
impl PartialEq for ActivationFunc
Auto Trait Implementations
impl Send for ActivationFunc
impl Send for ActivationFunc
impl Sync for ActivationFunc
impl Sync for ActivationFunc