Interface Model

    • Method Detail

      • init

        void init()
        Init the model
      • setListeners

        void setListeners​(Collection<TrainingListener> listeners)
        Set the trainingListeners for the ComputationGraph (and all layers in the network)
      • setListeners

        void setListeners​(TrainingListener... listeners)
        Set the trainingListeners for the ComputationGraph (and all layers in the network)
      • addListeners

        void addListeners​(TrainingListener... listener)
        This method ADDS additional TrainingListener to existing listeners
        Parameters:
        listener -
      • fit

        @Deprecated
        void fit()
        Deprecated.
        All models have a fit method
      • update

        void update​(Gradient gradient)
        Update layer weights and biases with gradient change
      • update

        void update​(INDArray gradient,
                    String paramType)
        Perform one update applying the gradient
        Parameters:
        gradient - the gradient to apply
      • score

        double score()
        The score for the model
        Returns:
        the score for the model
      • computeGradientAndScore

        void computeGradientAndScore​(LayerWorkspaceMgr workspaceMgr)
        Update the score
      • params

        INDArray params()
        Parameters of the model (if any)
        Returns:
        the parameters of the model
      • numParams

        long numParams()
        the number of parameters for the model
        Returns:
        the number of parameters for the model
      • numParams

        long numParams​(boolean backwards)
        the number of parameters for the model
        Returns:
        the number of parameters for the model
      • setParams

        void setParams​(INDArray params)
        Set the parameters for this model. This expects a linear ndarray which then be unpacked internally relative to the expected ordering of the model
        Parameters:
        params - the parameters for the model
      • setParamsViewArray

        void setParamsViewArray​(INDArray params)
        Set the initial parameters array as a view of the full (backprop) network parameters NOTE: this is intended to be used internally in MultiLayerNetwork and ComputationGraph, not by users.
        Parameters:
        params - a 1 x nParams row vector that is a view of the larger (MLN/CG) parameters array
      • getGradientsViewArray

        INDArray getGradientsViewArray()
      • setBackpropGradientsViewArray

        void setBackpropGradientsViewArray​(INDArray gradients)
        Set the gradients array as a view of the full (backprop) network parameters NOTE: this is intended to be used internally in MultiLayerNetwork and ComputationGraph, not by users.
        Parameters:
        gradients - a 1 x nParams row vector that is a view of the larger (MLN/CG) gradients array
      • fit

        void fit​(INDArray data,
                 LayerWorkspaceMgr workspaceMgr)
        Fit the model to the given data
        Parameters:
        data - the data to fit the model to
      • gradient

        Gradient gradient()
        Get the gradient. Note that this method will not calculate the gradient, it will rather return the gradient that has been computed before. For calculating the gradient, see computeGradientAndScore(LayerWorkspaceMgr) } .
        Returns:
        the gradient for this model, as calculated before
      • gradientAndScore

        Pair<Gradient,​Double> gradientAndScore()
        Get the gradient and score
        Returns:
        the gradient and score
      • batchSize

        int batchSize()
        The current inputs batch size
        Returns:
        the current inputs batch size
      • conf

        NeuralNetConfiguration conf()
        The configuration for the neural network
        Returns:
        the configuration for the neural network
      • input

        INDArray input()
        The input/feature matrix for the model
        Returns:
        the input/feature matrix for the model
      • getOptimizer

        ConvexOptimizer getOptimizer()
        Returns this models optimizer
        Returns:
        this models optimizer
      • getParam

        INDArray getParam​(String param)
        Get the parameter
        Parameters:
        param - the key of the parameter
        Returns:
        the parameter vector/matrix with that particular key
      • paramTable

        Map<String,​INDArray> paramTable​(boolean backpropParamsOnly)
        Table of parameters by key, for backprop For many models (dense layers, etc) - all parameters are backprop parameters
        Parameters:
        backpropParamsOnly - If true, return backprop params only. If false: return all params (equivalent to paramsTable())
      • setParamTable

        void setParamTable​(Map<String,​INDArray> paramTable)
        Setter for the param table
        Parameters:
        paramTable -
      • setParam

        void setParam​(String key,
                      INDArray val)
        Set the parameter with a new ndarray
        Parameters:
        key - the key to se t
        val - the new ndarray
      • clear

        void clear()
        Clear input
      • applyConstraints

        void applyConstraints​(int iteration,
                              int epoch)
        Apply any constraints to the model
      • close

        void close()