public abstract class GDBTrainer extends DatasetTrainer<ModelsComposition,Double>
DecisionTreeRegressionTrainer
, KNNRegressionTrainer
,
LinearRegressionLSQRTrainer
, RandomForestRegressionTrainer
, LinearRegressionSGDTrainer
.
But in practice Decision Trees is most used regressors (see: DecisionTreeRegressionTrainer
).Modifier and Type | Class and Description |
---|---|
static class |
GDBTrainer.GDBModel
GDB model.
|
DatasetTrainer.EmptyDatasetException
Modifier and Type | Field and Description |
---|---|
protected ConvergenceCheckerFactory |
checkConvergenceStgyFactory
Check convergence strategy factory.
|
protected Loss |
loss
Loss function.
|
envBuilder, environment
Constructor and Description |
---|
GDBTrainer(double gradStepSize,
Integer cntOfIterations,
Loss loss)
Constructs GDBTrainer instance.
|
Modifier and Type | Method and Description |
---|---|
protected abstract @NotNull DatasetTrainer<? extends IgniteModel<Vector,Double>,Double> |
buildBaseModelTrainer()
Returns regressor model trainer for one step of GDB.
|
protected <V,K,C extends Serializable> |
computeInitialValue(LearningEnvironmentBuilder envBuilder,
DatasetBuilder<K,V> builder,
Preprocessor<K,V> preprocessor)
Compute mean value of label as first approximation.
|
protected abstract double |
externalLabelToInternal(double lbl)
Maps external representation of label to internal.
|
<K,V> ModelsComposition |
fitWithInitializedDeployingContext(DatasetBuilder<K,V> datasetBuilder,
Preprocessor<K,V> preprocessor)
Trains model based on the specified data.
|
protected GDBLearningStrategy |
getLearningStrategy()
Returns learning strategy.
|
protected abstract double |
internalLabelToExternal(double lbl)
Maps internal representation of label to external.
|
boolean |
isUpdateable(ModelsComposition mdl) |
protected abstract <V,K> boolean |
learnLabels(DatasetBuilder<K,V> builder,
Preprocessor<K,V> preprocessor)
Defines unique labels in dataset if need (useful in case of classification).
|
protected <K,V> ModelsComposition |
updateModel(ModelsComposition mdl,
DatasetBuilder<K,V> datasetBuilder,
Preprocessor<K,V> preprocessor)
Trains new model taken previous one as a first approximation.
|
GDBTrainer |
withCheckConvergenceStgyFactory(ConvergenceCheckerFactory factory)
Sets CheckConvergenceStgyFactory.
|
GDBTrainer |
withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder)
Changes learning Environment.
|
fit, fit, fit, fit, fit, fit, getLastTrainedModelOrThrowEmptyDatasetException, identityTrainer, learningEnvironment, update, update, update, update, update, withConvertedLabels
protected final Loss loss
protected ConvergenceCheckerFactory checkConvergenceStgyFactory
public GDBTrainer(double gradStepSize, Integer cntOfIterations, Loss loss)
gradStepSize
- Grad step size.cntOfIterations
- Count of learning iterations.loss
- Gradient of loss function. First argument is sample size, second argument is valid answer third
argument is current model prediction.public <K,V> ModelsComposition fitWithInitializedDeployingContext(DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> preprocessor)
fitWithInitializedDeployingContext
in class DatasetTrainer<ModelsComposition,Double>
K
- Type of a key in upstream
data.V
- Type of a value in upstream
data.datasetBuilder
- Dataset builder.preprocessor
- Extractor of UpstreamEntry
into LabeledVector
.protected <K,V> ModelsComposition updateModel(ModelsComposition mdl, DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> preprocessor)
updateModel
in class DatasetTrainer<ModelsComposition,Double>
K
- Type of a key in upstream
data.V
- Type of a value in upstream
data.mdl
- Learned model.datasetBuilder
- Dataset builder.preprocessor
- Extractor of UpstreamEntry
into LabeledVector
.public boolean isUpdateable(ModelsComposition mdl)
isUpdateable
in class DatasetTrainer<ModelsComposition,Double>
mdl
- Model.public GDBTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder)
withEnvironmentBuilder
in class DatasetTrainer<ModelsComposition,Double>
envBuilder
- Learning environment builder.protected abstract <V,K> boolean learnLabels(DatasetBuilder<K,V> builder, Preprocessor<K,V> preprocessor)
builder
- Dataset builder.preprocessor
- Upstream preprocessor.@NotNull protected abstract @NotNull DatasetTrainer<? extends IgniteModel<Vector,Double>,Double> buildBaseModelTrainer()
protected abstract double externalLabelToInternal(double lbl)
lbl
- Label value.protected abstract double internalLabelToExternal(double lbl)
lbl
- Label value.protected <V,K,C extends Serializable> IgniteBiTuple<Double,Long> computeInitialValue(LearningEnvironmentBuilder envBuilder, DatasetBuilder<K,V> builder, Preprocessor<K,V> preprocessor)
builder
- Dataset builder.envBuilder
- Learning environment builder.preprocessor
- Vectorizer.public GDBTrainer withCheckConvergenceStgyFactory(ConvergenceCheckerFactory factory)
factory
- Factory.protected GDBLearningStrategy getLearningStrategy()
GridGain In-Memory Computing Platform : ver. 8.9.15 Release Date : December 3 2024