Package org.deeplearning4j.util
Class OutputLayerUtil
- java.lang.Object
-
- org.deeplearning4j.util.OutputLayerUtil
-
public class OutputLayerUtil extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
activationExceedsZeroOneRange(IActivation activation, boolean isLossLayer)
static boolean
lossFunctionExpectsProbability(ILossFunction lf)
static void
validateOutputLayer(String layerName, Layer layer)
Validate the output layer (or loss layer) configuration, to detect invalid consfiugrations.static void
validateOutputLayerConfiguration(String layerName, long nOut, boolean isLossLayer, IActivation activation, ILossFunction lossFunction)
Validate the output layer (or loss layer) configuration, to detect invalid consfiugrations.static void
validateOutputLayerForClassifierEvaluation(Layer outputLayer, Class<? extends IEvaluation> classifierEval)
Validates if the output layer configuration is valid for classifier evaluation.
-
-
-
Method Detail
-
validateOutputLayer
public static void validateOutputLayer(String layerName, Layer layer)
Validate the output layer (or loss layer) configuration, to detect invalid consfiugrations. A DL4JInvalidConfigException will be thrown for invalid configurations (like softmax + nOut=1).
If the specified layer is not an output layer, this is a no-op- Parameters:
layerName
- Name of the layerlayer
- Layer
-
validateOutputLayerConfiguration
public static void validateOutputLayerConfiguration(String layerName, long nOut, boolean isLossLayer, IActivation activation, ILossFunction lossFunction)
Validate the output layer (or loss layer) configuration, to detect invalid consfiugrations. A DL4JInvalidConfigException will be thrown for invalid configurations (like softmax + nOut=1).
If the specified layer is not an output layer, this is a no-op
- Parameters:
layerName
- Name of the layernOut
- Number of outputs for the layerisLossLayer
- Should be true for loss layers (no params), false for output layersactivation
- Activation functionlossFunction
- Loss function
-
lossFunctionExpectsProbability
public static boolean lossFunctionExpectsProbability(ILossFunction lf)
-
activationExceedsZeroOneRange
public static boolean activationExceedsZeroOneRange(IActivation activation, boolean isLossLayer)
-
validateOutputLayerForClassifierEvaluation
public static void validateOutputLayerForClassifierEvaluation(Layer outputLayer, Class<? extends IEvaluation> classifierEval)
Validates if the output layer configuration is valid for classifier evaluation. This is used to try and catch invalid evaluation - i.e., trying to use classifier evaluation on a regression model. This method won't catch all possible invalid cases, but should catch some common problems.- Parameters:
outputLayer
- Output layerclassifierEval
- Class for the classifier evaluation
-
-