Documentation of 'jsat.classifiers.neuralnetwork.BackPropagationNet' Java class
BackPropagationNet
jsat.classifiers.neuralnetwork

Class BackPropagationNet

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Classifier, Parameterized, Regressor


    public class BackPropagationNet
    extends java.lang.Object
    implements Classifier, Regressor, Parameterized
    An implementation of a Feed Forward Neural Network (NN) trained by Back Propagation. NNs are powerful classifiers and regressors, but can suffer from slow training time and overfitting.

    NOTE: This class should generally not be used any more. The DReDNetSimple provides an easier to use class for most cases that will likely converge faster.
    See Also:
    Serialized Form
    • Field Detail

      • logitActiv

        public static final BackPropagationNet.ActivationFunction logitActiv
        The logit activation function. This function goes from [0, 1]. It has more difficultly learning than symmetric activation functions, often requiring considerably more layers and neurons than other activation functions.
      • tanhActiv

        public static final BackPropagationNet.ActivationFunction tanhActiv
        The tanh activation function. This function is symmetric in the range of [-1, 1]. It works well for many problems in general.
      • softsignActiv

        public static final BackPropagationNet.ActivationFunction softsignActiv
        The softsign activation function. This function is symmetric in the range of [-1, 1]. It works well for classification problems, and is very fast to compute. It sometimes requires more neurons to learn more complicated functions / boundaries. It sometimes has reduced performance in regression
    • Constructor Detail

      • BackPropagationNet

        public BackPropagationNet()
        Creates a new back propagation network with one hidden layer of 1024 neurons.
        Parameters:
        npl - the array of hidden layer information. The length indicates how many hidden layers, and the value of each index indicates how many neurons to place in each hidden layer
      • BackPropagationNet

        public BackPropagationNet(int... npl)
        Creates a new back propagation network.
        Parameters:
        npl - the array of hidden layer information. The length indicates how many hidden layers, and the value of each index indicates how many neurons to place in each hidden layer
    • Method Detail

      • setMomentum

        public void setMomentum(double momentum)
        Sets the non negative momentum used in training.
        Parameters:
        momentum - the momentum to apply to training
      • getMomentum

        public double getMomentum()
        Returns the momentum in use
        Returns:
        the momentum
      • setInitialLearningRate

        public void setInitialLearningRate(double initialLearningRate)
        Sets the initial learning rate used for the first epoch
        Parameters:
        initialLearningRate - the positive learning rate to use
      • getInitialLearningRate

        public double getInitialLearningRate()
        Returns the learning rate used
        Returns:
        the learning rate used
      • setLearningRateDecay

        public void setLearningRateDecay(DecayRate learningRateDecay)
        Sets the decay rate used to adjust the learning rate after each epoch
        Parameters:
        learningRateDecay - the decay for the learning rate
      • getLearningRateDecay

        public DecayRate getLearningRateDecay()
        Returns the decay rate used to adjust the learning rate after each epoch
        Returns:
        the decay rate used for learning
      • setEpochs

        public void setEpochs(int epochs)
        Sets the number of epochs of training used. Each epoch goes through the whole data set once.
        Parameters:
        epochs - the number of training epochs
      • getEpochs

        public int getEpochs()
        Returns the number of epochs of training epochs for learning
        Returns:
        the number of training epochs
      • setWeightDecay

        public void setWeightDecay(double weightDecay)
        Sets the weight decay used for each update. The weight decay must be in the range [0, 1). Weight decay values must often be very small, often 1e-8 or less.
        Parameters:
        weightDecay - the weight decay to apply when training
      • getWeightDecay

        public double getWeightDecay()
        Returns the weight decay used for each update
        Returns:
        the weight decay used.
      • setWeightInitialization

        public void setWeightInitialization(BackPropagationNet.WeightInitialization weightInitialization)
        Sets how the weights are initialized before training starts
        Parameters:
        weightInitialization - the method of weight initialization
      • getWeightInitialization

        public BackPropagationNet.WeightInitialization getWeightInitialization()
        Returns the method of weight initialization used
        Returns:
        the method of weight initialization used
      • setBatchSize

        public void setBatchSize(int batchSize)
        Sets the batch size use to estimate the gradient of the error for training
        Parameters:
        batchSize - the number of training instances to use on each update
      • getBatchSize

        public int getBatchSize()
        Returns the training batch size
        Returns:
        the batch size used for training
      • setActivationFunction

        public void setActivationFunction(BackPropagationNet.ActivationFunction f)
        Sets the activation function used for the network
        Parameters:
        f - the activation function to use
      • getActivationFunction

        public BackPropagationNet.ActivationFunction getActivationFunction()
        Returns the activation function used for training the network
        Returns:
        the activation function in use
      • classify

        public CategoricalResults classify(DataPoint data)
        Description copied from interface: Classifier
        Performs classification on the given data point.
        Specified by:
        classify in interface Classifier
        Parameters:
        data - the data point to classify
        Returns:
        the results of the classification.
      • train

        public void train(ClassificationDataSet dataSet,
                          boolean parallel)
        Description copied from interface: Classifier
        Trains the classifier and constructs a model for classification using the given data set. If the training method knows how, it will used the threadPool to conduct training in parallel. This method will block until the training has completed.
        Specified by:
        train in interface Classifier
        Parameters:
        dataSet - the data set to train on
        parallel - true if multiple threads should be used to train the model. false if it should be done in a single threaded manner.
      • train

        public void train(ClassificationDataSet dataSet)
        Description copied from interface: Classifier
        Trains the classifier and constructs a model for classification using the given data set.
        Specified by:
        train in interface Classifier
        Parameters:
        dataSet - the data set to train on
      • supportsWeightedData

        public boolean supportsWeightedData()
        Description copied from interface: Classifier
        Indicates whether the model knows how to train using weighted data points. If it does, the model will train assuming the weights. The values returned by this method may change depending on the parameters set for the model.
        Specified by:
        supportsWeightedData in interface Classifier
        Specified by:
        supportsWeightedData in interface Regressor
        Returns:
        true if the model supports weighted data, false otherwise
      • getParameters

        public java.util.List<Parameter> getParameters()
        Description copied from interface: Parameterized
        Returns the list of parameters that can be altered for this learner.
        Specified by:
        getParameters in interface Parameterized
        Returns:
        the list of parameters that can be altered for this learner.
      • getParameter

        public Parameter getParameter(java.lang.String paramName)
        Description copied from interface: Parameterized
        Returns the parameter with the given name. Two different strings may map to a single Parameter object. An ASCII only string, and a Unicode style string.
        Specified by:
        getParameter in interface Parameterized
        Parameters:
        paramName - the name of the parameter to obtain
        Returns:
        the Parameter in question, or null if no such named Parameter exists.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.