# Activation

Compute activation function values and write them to the passed vector/matrix.

 bool vector::Activation(   vector&                   vect_out,      // vector to get values   ENUM_ACTIVATION_FUNCTION  activation,    // activation function    ...                                     // additional parameters    );     bool matrix::Activation(   matrix&                   matrix_out,    // matrix to get values   ENUM_ACTIVATION_FUNCTION  activation     // activation function    );     bool matrix::Activation(   matrix&                   matrix_out,    // matrix to get values   ENUM_ACTIVATION_FUNCTION  activation,    // activation function   ENUM_MATRIX_AXIS          axis,          // axis    ...                                     // additional parameters    );

Parameters

vect_out/matrix_out

[out]  Vector or matrix to get the computed values of the activation function.

activation

[in]  Activation function from the ENUM_ACTIVATION_FUNCTION enumeration.

axis

[in] ENUM_MATRIX_AXIS enumeration value (AXIS_HORZ — horizontal axis, AXIS_VERT — vertical axis).

...

[in]  Additional parameters required for some activation functions. If no parameters are specified, default values are used.

Return Value

Returns true if successful, otherwise - false.

Some activation functions accept additional parameters. If no parameters are specified, default values are used

 AF_ELU  (Exponential Linear Unit)        double alpha=1.0        Activation function: if(x>=0) f(x) = x                       else f(x) = alpha * (exp(x)-1)            AF_LINEAR         double alpha=1.0      double beta=0.0        Activation function: f(x) = alpha*x + beta            AF_LRELU   (Leaky REctified Linear Unit)         double alpha=0.3        Activation function: if(x>=0) f(x)=x                       else f(x) = alpha*x                                 AF_RELU  (REctified Linear Unit)         double alpha=0.0      double max_value=0.0      double treshold=0.0        Activation function: if(alpha==0) f(x) = max(x,0)                       else if(x>max_value) f(x) = x                       else f(x) = alpha*(x - treshold)            AF_SWISH         double beta=1.0        Activation function: f(x) = x / (1+exp(-x*beta))            AF_TRELU   (Thresholded REctified Linear Unit)         double theta=1.0        Activation function: if(x>theta) f(x) = x                       else f(x) = 0            AF_PRELU   (Parametric REctified Linear Unit)         double alpha[] - learned array of coeefficients        Activation function: if(x[i]>=0) f(x)[i] = x[i]                       else f(x)[i] = alpha[i] * x[i]

Note

In artificial neural networks, the activation function of a neuron determines the output signal, which is defined by an input signal or a set of input signals. The selection of the activation function has a big impact on the neural network performance. Different model parts (layers) can use different activation functions.