public class BackPropagationNet extends Object implements Classifier, Regressor, Parameterized
DReDNetSimple
provides an easier to use class for most cases that
will likely converge faster.Modifier and Type | Class and Description |
---|---|
static class |
BackPropagationNet.ActivationFunction
The neural network needs an activation function for the neurons that is
used to predict from inputs and train the network by propagating the
errors back through the network.
|
static class |
BackPropagationNet.WeightInitialization
Different methods of initializing the weight values before training
|
Modifier and Type | Field and Description |
---|---|
static BackPropagationNet.ActivationFunction |
logitActiv
The logit activation function.
|
static BackPropagationNet.ActivationFunction |
softsignActiv
The softsign activation function.
|
static BackPropagationNet.ActivationFunction |
tanhActiv
The tanh activation function.
|
Modifier | Constructor and Description |
---|---|
|
BackPropagationNet()
Creates a new back propagation network with one hidden layer of 1024 neurons.
|
protected |
BackPropagationNet(BackPropagationNet toClone)
Copy constructor
|
|
BackPropagationNet(int... npl)
Creates a new back propagation network.
|
Modifier and Type | Method and Description |
---|---|
CategoricalResults |
classify(DataPoint data)
Performs classification on the given data point.
|
BackPropagationNet |
clone() |
BackPropagationNet.ActivationFunction |
getActivationFunction()
Returns the activation function used for training the network
|
int |
getBatchSize()
Returns the training batch size
|
int |
getEpochs()
Returns the number of epochs of training epochs for learning
|
double |
getInitialLearningRate()
Returns the learning rate used
|
DecayRate |
getLearningRateDecay()
Returns the decay rate used to adjust the learning rate after each epoch
|
double |
getMomentum()
Returns the momentum in use
|
Parameter |
getParameter(String paramName)
Returns the parameter with the given name.
|
List<Parameter> |
getParameters()
Returns the list of parameters that can be altered for this learner.
|
double |
getWeightDecay()
Returns the weight decay used for each update
|
BackPropagationNet.WeightInitialization |
getWeightInitialization()
Returns the method of weight initialization used
|
double |
regress(DataPoint data) |
void |
setActivationFunction(BackPropagationNet.ActivationFunction f)
Sets the activation function used for the network
|
void |
setBatchSize(int batchSize)
Sets the batch size use to estimate the gradient of the error for
training
|
void |
setEpochs(int epochs)
Sets the number of epochs of training used.
|
void |
setInitialLearningRate(double initialLearningRate)
Sets the initial learning rate used for the first epoch
|
void |
setLearningRateDecay(DecayRate learningRateDecay)
Sets the decay rate used to adjust the learning rate after each epoch
|
void |
setMomentum(double momentum)
Sets the non negative momentum used in training.
|
void |
setWeightDecay(double weightDecay)
Sets the weight decay used for each update.
|
void |
setWeightInitialization(BackPropagationNet.WeightInitialization weightInitialization)
Sets how the weights are initialized before training starts
|
boolean |
supportsWeightedData()
Indicates whether the model knows how to train using weighted data points.
|
void |
train(RegressionDataSet dataSet) |
void |
train(RegressionDataSet dataSet,
ExecutorService threadPool) |
void |
trainC(ClassificationDataSet dataSet)
Trains the classifier and constructs a model for classification using the
given data set.
|
void |
trainC(ClassificationDataSet dataSet,
ExecutorService threadPool)
Trains the classifier and constructs a model for classification using the
given data set.
|
public static final BackPropagationNet.ActivationFunction logitActiv
public static final BackPropagationNet.ActivationFunction tanhActiv
public static final BackPropagationNet.ActivationFunction softsignActiv
public BackPropagationNet()
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 layerpublic BackPropagationNet(int... npl)
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 layerprotected BackPropagationNet(BackPropagationNet toClone)
toClone
- the one to copypublic void setMomentum(double momentum)
momentum
- the momentum to apply to trainingpublic double getMomentum()
public void setInitialLearningRate(double initialLearningRate)
initialLearningRate
- the positive learning rate to usepublic double getInitialLearningRate()
public void setLearningRateDecay(DecayRate learningRateDecay)
learningRateDecay
- the decay for the learning ratepublic DecayRate getLearningRateDecay()
public void setEpochs(int epochs)
epochs
- the number of training epochspublic int getEpochs()
public void setWeightDecay(double weightDecay)
weightDecay
- the weight decay to apply when trainingpublic double getWeightDecay()
public void setWeightInitialization(BackPropagationNet.WeightInitialization weightInitialization)
weightInitialization
- the method of weight initializationpublic BackPropagationNet.WeightInitialization getWeightInitialization()
public void setBatchSize(int batchSize)
batchSize
- the number of training instances to use on each updatepublic int getBatchSize()
public void setActivationFunction(BackPropagationNet.ActivationFunction f)
f
- the activation function to usepublic BackPropagationNet.ActivationFunction getActivationFunction()
public CategoricalResults classify(DataPoint data)
Classifier
classify
in interface Classifier
data
- the data point to classifypublic void trainC(ClassificationDataSet dataSet, ExecutorService threadPool)
Classifier
trainC
in interface Classifier
dataSet
- the data set to train onthreadPool
- the source of threads to use.public void trainC(ClassificationDataSet dataSet)
Classifier
trainC
in interface Classifier
dataSet
- the data set to train onpublic void train(RegressionDataSet dataSet, ExecutorService threadPool)
public void train(RegressionDataSet dataSet)
public boolean supportsWeightedData()
Classifier
supportsWeightedData
in interface Classifier
supportsWeightedData
in interface Regressor
public BackPropagationNet clone()
public List<Parameter> getParameters()
Parameterized
getParameters
in interface Parameterized
public Parameter getParameter(String paramName)
Parameterized
getParameter
in interface Parameterized
paramName
- the name of the parameter to obtainCopyright © 2017. All rights reserved.