Package deepnetts.net.layers.activation
Interface ActivationFunction
- All Superinterfaces:
Consumer<TensorBase>
Common base interface for all activation functions used in layers.
Classes implementing this interface should provide methods for calculating
value and first derivative of the activation function.
Activation function performs non-linear transformation of its input
before its sent to layer output.
First derivative of a function shows how fast and in what direction function
is changing if its input changes, and it is used by training algorithm.
For more see https://en.wikipedia.org/wiki/Activation_function
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
accept
(TensorBase tensor) void
void
apply
(TensorBase tensor, int from, int to) static ActivationFunction
create
(ActivationType type) Creates and returns specified type of activation function.float
getPrime
(float y) Returns the first derivative of activation function for specified output yfloat
getValue
(float x) Returns the value of activation function for specified input x
-
Method Details
-
getValue
float getValue(float x) Returns the value of activation function for specified input x- Parameters:
x
- input for activation- Returns:
- value of activation function
-
apply
-
apply
-
accept
- Specified by:
accept
in interfaceConsumer<TensorBase>
-
getPrime
float getPrime(float y) Returns the first derivative of activation function for specified output y- Parameters:
y
- output of activation function- Returns:
- first derivative of activation function
-
create
Creates and returns specified type of activation function. A factory method for creating activation functions;- Parameters:
type
- type of the activation function- Returns:
- returns instance of specified activation function type
-