public class LinearRegressionSGDTrainer<P extends Serializable> extends SingleLabelDatasetTrainer<LinearRegressionModel>
DatasetTrainer.EmptyDatasetException
envBuilder, environment
Constructor and Description |
---|
LinearRegressionSGDTrainer(UpdatesStrategy<? super MultilayerPerceptron,P> updatesStgy)
Constructs a new instance of linear regression SGD trainer.
|
LinearRegressionSGDTrainer(UpdatesStrategy<? super MultilayerPerceptron,P> updatesStgy,
int maxIterations,
int batchSize,
int locIterations,
long seed)
Constructs a new instance of linear regression SGD trainer.
|
Modifier and Type | Method and Description |
---|---|
<K,V> LinearRegressionModel |
fitWithInitializedDeployingContext(DatasetBuilder<K,V> datasetBuilder,
Preprocessor<K,V> extractor)
Trains model based on the specified data.
|
int |
getBatchSize()
Get the batch size.
|
int |
getLocIterations()
Get the amount of local iterations.
|
int |
getMaxIterations()
Get the max amount of iterations.
|
long |
getSeed()
Get the seed for random generator.
|
UpdatesStrategy<? super MultilayerPerceptron,P> |
getUpdatesStgy()
Get the update strategy.
|
boolean |
isUpdateable(LinearRegressionModel mdl) |
protected <K,V> LinearRegressionModel |
updateModel(LinearRegressionModel mdl,
DatasetBuilder<K,V> datasetBuilder,
Preprocessor<K,V> extractor)
Trains new model taken previous one as a first approximation.
|
LinearRegressionSGDTrainer<P> |
withBatchSize(int batchSize)
Set up the batchSize parameter.
|
LinearRegressionSGDTrainer<P> |
withLocIterations(int amountOfLocIterations)
Set up the amount of local iterations of SGD algorithm.
|
LinearRegressionSGDTrainer<P> |
withMaxIterations(int maxIterations)
Set up the max amount of iterations before convergence.
|
LinearRegressionSGDTrainer<P> |
withSeed(long seed)
Set up the random seed parameter.
|
fit, fit, fit, fit, fit, fit, getLastTrainedModelOrThrowEmptyDatasetException, identityTrainer, learningEnvironment, update, update, update, update, update, withConvertedLabels, withEnvironmentBuilder
public LinearRegressionSGDTrainer(UpdatesStrategy<? super MultilayerPerceptron,P> updatesStgy, int maxIterations, int batchSize, int locIterations, long seed)
updatesStgy
- Update strategy.maxIterations
- Max number of iteration.batchSize
- Batch size.locIterations
- Number of local iterations.seed
- Seed for random generator.public LinearRegressionSGDTrainer(UpdatesStrategy<? super MultilayerPerceptron,P> updatesStgy)
public <K,V> LinearRegressionModel fitWithInitializedDeployingContext(DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> extractor)
fitWithInitializedDeployingContext
in class DatasetTrainer<LinearRegressionModel,Double>
K
- Type of a key in upstream
data.V
- Type of a value in upstream
data.datasetBuilder
- Dataset builder.extractor
- Extractor of UpstreamEntry
into LabeledVector
.protected <K,V> LinearRegressionModel updateModel(LinearRegressionModel mdl, DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> extractor)
updateModel
in class DatasetTrainer<LinearRegressionModel,Double>
K
- Type of a key in upstream
data.V
- Type of a value in upstream
data.mdl
- Learned model.datasetBuilder
- Dataset builder.extractor
- Extractor of UpstreamEntry
into LabeledVector
.public boolean isUpdateable(LinearRegressionModel mdl)
isUpdateable
in class DatasetTrainer<LinearRegressionModel,Double>
mdl
- Model.public LinearRegressionSGDTrainer<P> withMaxIterations(int maxIterations)
maxIterations
- The parameter value.public LinearRegressionSGDTrainer<P> withBatchSize(int batchSize)
batchSize
- The size of learning batch.public LinearRegressionSGDTrainer<P> withLocIterations(int amountOfLocIterations)
amountOfLocIterations
- The parameter value.public LinearRegressionSGDTrainer<P> withSeed(long seed)
seed
- Seed for random generator.public UpdatesStrategy<? super MultilayerPerceptron,P> getUpdatesStgy()
public int getMaxIterations()
public int getBatchSize()
public int getLocIterations()
public long getSeed()
GridGain In-Memory Computing Platform : ver. 8.9.15 Release Date : December 3 2024