Class Softmax
java.lang.Object
com.jml.neural_network.activations.Softmax
- All Implemented Interfaces:
ActivationFunction
The softmax activation function. f(x)i = exp(x_i) / sumj=1m( exp(xj) ) where
x is a vector of length m and sumj=1m ( exp(xj) ) = exp(x1) + exp(x2) + ... + exp(xm).
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlinalg.Matrix
back(linalg.Matrix data)
Applies the derivative of the activation function, element-wise, to a matrix.linalg.Matrix
forward(linalg.Matrix data)
Applies the activation function, element-wise, to a matrix.getName()
Gets the name of the activation function.
-
Field Details
-
NAME
- See Also:
- Constant Field Values
-
-
Constructor Details
-
Softmax
public Softmax()
-
-
Method Details
-
forward
public linalg.Matrix forward(linalg.Matrix data)Applies the activation function, element-wise, to a matrix.- Specified by:
forward
in interfaceActivationFunction
- Parameters:
data
- The matrix to apply activation function to.- Returns:
- The result of the element-wise activation function applied to the matrix.
-
back
public linalg.Matrix back(linalg.Matrix data)Applies the derivative of the activation function, element-wise, to a matrix.- Specified by:
back
in interfaceActivationFunction
- Parameters:
data
- The matrix to apply the derivative of the activation function to.- Returns:
- The slope of the activation function, evaluated element-wise, of the data matrix.
-
getName
Gets the name of the activation function.- Specified by:
getName
in interfaceActivationFunction
- Returns:
- The name of the activation function as a String.
-