public class SoftMax extends BaseActivationFunction
Constructor and Description |
---|
SoftMax()
Initializes softmax with column wise features
|
SoftMax(boolean rows)
Initialize softmax with whether to use row wise or column wise features
|
Modifier and Type | Method and Description |
---|---|
INDArray |
apply(INDArray input)
Returns the result of applying this function to
input . |
INDArray |
applyDerivative(INDArray input)
Applies the derivative of this function
|
static INDArray |
softmax(INDArray input,
boolean row)
Soft max function
row_maxes is a row vector (max for each row)
row_maxes = rowmaxes(input)
diff = exp(input - max) / diff.rowSums()
|
Class<? extends ElementWiseOp> |
transformClazz()
The class used for transformation
|
equals, toString, type
public SoftMax(boolean rows)
rows
- whether to use row wise or column wise features for calculationpublic SoftMax()
public static INDArray softmax(INDArray input, boolean row)
input
- the input for the softmaxrow
- whether the row maxes should be taken or the column maxes,
this is dependent on whether the features are column wise or row wisepublic INDArray apply(INDArray input)
BaseActivationFunction
input
. This method is generally
expected, but not absolutely required, to have the following properties:
Objects.equal
(a, b)
implies that Objects.equal(function.apply(a),
function.apply(b))
.
apply
in interface com.google.common.base.Function<INDArray,INDArray>
apply
in class BaseActivationFunction
public Class<? extends ElementWiseOp> transformClazz()
public INDArray applyDerivative(INDArray input)
ActivationFunction
input
- the input to apply it toCopyright © 2014. All Rights Reserved.