Class OutputLayerUtil


  • public class OutputLayerUtil
    extends Object
    • 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 layer
        layer - 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 layer
        nOut - Number of outputs for the layer
        isLossLayer - Should be true for loss layers (no params), false for output layers
        activation - Activation function
        lossFunction - 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 layer
        classifierEval - Class for the classifier evaluation