jsat.classifiers.neuralnetwork
Class DReDNetSimple
- java.lang.Object
-
- jsat.classifiers.neuralnetwork.DReDNetSimple
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Classifier, Parameterized
public class DReDNetSimple extends java.lang.Object implements Classifier, Parameterized
This class provides a neural network based on Geoffrey Hinton's Deep Rectified Dropout Nets. It is parameterized to be "simpler" in that the default batch size and gradient updating method should require no tuning to get decent results
NOTE: Training neural networks is computationally expensive, you may want to consider a GPU implementation from another source.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description DReDNetSimple()Creates a new DRedNet that uses two hidden layers with 1024 neurons each.DReDNetSimple(int... hiddenLayerSizes)Create a new DReDNet that uses the specified number of hidden layers.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description CategoricalResultsclassify(DataPoint data)Performs classification on the given data point.DReDNetSimpleclone()intgetBatchSize()intgetEpochs()int[]getHiddenSizes()voidsetBatchSize(int batchSize)Sets the batch size for updatesvoidsetEpochs(int epochs)Sets the number of epochs to performvoidsetHiddenSizes(int[] hiddenSizes)Sets the hidden layer sizes for this network.booleansupportsWeightedData()Indicates whether the model knows how to train using weighted data points.voidtrain(ClassificationDataSet dataSet, boolean parallel)Trains the classifier and constructs a model for classification using the given data set.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jsat.classifiers.Classifier
train
-
Methods inherited from interface jsat.parameters.Parameterized
getParameter, getParameters
-
-
-
-
Constructor Detail
-
DReDNetSimple
public DReDNetSimple()
Creates a new DRedNet that uses two hidden layers with 1024 neurons each. A batch size of 256 and 100 epochs will be used.
-
DReDNetSimple
public DReDNetSimple(int... hiddenLayerSizes)
Create a new DReDNet that uses the specified number of hidden layers. A batch size of 256 and 100 epochs will be used.- Parameters:
hiddenLayerSizes- the length indicates the number of hidden layers, and the value in each index is the number of neurons in that layer
-
-
Method Detail
-
setHiddenSizes
public void setHiddenSizes(int[] hiddenSizes)
Sets the hidden layer sizes for this network. The size of the array is the number of hidden layers and the value in each index denotes the size of that layer.- Parameters:
hiddenSizes-
-
getHiddenSizes
public int[] getHiddenSizes()
- Returns:
- the array of hidden layer sizes
-
setBatchSize
public void setBatchSize(int batchSize)
Sets the batch size for updates- Parameters:
batchSize- the number of items to compute the gradient from
-
getBatchSize
public int getBatchSize()
- Returns:
- the number of data points to use for one gradient computation
-
setEpochs
public void setEpochs(int epochs)
Sets the number of epochs to perform- Parameters:
epochs- the number of training iterations through the whole data set
-
getEpochs
public int getEpochs()
- Returns:
- the number of training iterations through the data set
-
classify
public CategoricalResults classify(DataPoint data)
Description copied from interface:ClassifierPerforms classification on the given data point.- Specified by:
classifyin interfaceClassifier- 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:ClassifierTrains 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:
trainin interfaceClassifier- Parameters:
dataSet- the data set to train onparallel-trueif multiple threads should be used to train the model.falseif it should be done in a single threaded manner.
-
supportsWeightedData
public boolean supportsWeightedData()
Description copied from interface:ClassifierIndicates 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:
supportsWeightedDatain interfaceClassifier- Returns:
- true if the model supports weighted data, false otherwise
-
clone
public DReDNetSimple clone()
- Specified by:
clonein interfaceClassifier- Overrides:
clonein classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG