Package de.jungblut.math.activation
Class SoftMaxActivationFunction
- java.lang.Object
-
- de.jungblut.math.activation.AbstractActivationFunction
-
- de.jungblut.math.activation.SoftMaxActivationFunction
-
- All Implemented Interfaces:
ActivationFunction
public final class SoftMaxActivationFunction extends AbstractActivationFunction
Softmax activation that only works on vectors, because it needs to sum and divide the probabilities. In the case of matrices, the row vectors are taken.- Author:
- thomas.jungblut
-
-
Constructor Summary
Constructors Constructor Description SoftMaxActivationFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doubleapply(double input)Applies the activation function on the given element.de.jungblut.math.DoubleMatrixapply(de.jungblut.math.DoubleMatrix matrix)Applies the gradient of the activation function on each element in the given matrix.de.jungblut.math.DoubleVectorapply(de.jungblut.math.DoubleVector vector)Applies the activation function on each element in the given vector.doublegradient(double input)Applies the gradient of the activation function on the given element.de.jungblut.math.DoubleMatrixgradient(de.jungblut.math.DoubleMatrix matrix)Applies the gradient of the activation function on each element in the given matrix.de.jungblut.math.DoubleVectorgradient(de.jungblut.math.DoubleVector vector)Applies the gradient of the activation function on each element in the given vector.-
Methods inherited from class de.jungblut.math.activation.AbstractActivationFunction
newInstance, newInstance, toString
-
-
-
-
Method Detail
-
apply
public double apply(double input)
Description copied from interface:ActivationFunctionApplies the activation function on the given element.
-
apply
public de.jungblut.math.DoubleVector apply(de.jungblut.math.DoubleVector vector)
Description copied from interface:ActivationFunctionApplies the activation function on each element in the given vector.- Specified by:
applyin interfaceActivationFunction- Overrides:
applyin classAbstractActivationFunction- Parameters:
vector- the vector to apply this function on.- Returns:
- a new vector that contains the activated elements.
-
apply
public de.jungblut.math.DoubleMatrix apply(de.jungblut.math.DoubleMatrix matrix)
Description copied from interface:ActivationFunctionApplies the gradient of the activation function on each element in the given matrix.- Specified by:
applyin interfaceActivationFunction- Overrides:
applyin classAbstractActivationFunction- Parameters:
matrix- the matrix to apply this function on.- Returns:
- a new matrix that contains the gradient of the elements.
-
gradient
public double gradient(double input)
Description copied from interface:ActivationFunctionApplies the gradient of the activation function on the given element.
-
gradient
public de.jungblut.math.DoubleVector gradient(de.jungblut.math.DoubleVector vector)
Description copied from interface:ActivationFunctionApplies the gradient of the activation function on each element in the given vector.- Specified by:
gradientin interfaceActivationFunction- Overrides:
gradientin classAbstractActivationFunction- Parameters:
vector- the vector to apply this function on.- Returns:
- a new vector that contains the gradient of the elements.
-
gradient
public de.jungblut.math.DoubleMatrix gradient(de.jungblut.math.DoubleMatrix matrix)
Description copied from interface:ActivationFunctionApplies the gradient of the activation function on each element in the given matrix.- Specified by:
gradientin interfaceActivationFunction- Overrides:
gradientin classAbstractActivationFunction- Parameters:
matrix- the matrix to apply this function on.- Returns:
- a new matrix that contains the gradient of the elements.
-
-