L
- Type of statistics aggregator for leaf values computing.S
- Type of impurity computer specific for algorithm.T
- Type of child of RandomForestTrainer using in with-methods.public abstract class RandomForestTrainer<L,S extends ImpurityComputer<BootstrappedVector,S>,T extends RandomForestTrainer<L,S,T>> extends SingleLabelDatasetTrainer<ModelsComposition>
DatasetTrainer.EmptyDatasetException
envBuilder, environment
Constructor and Description |
---|
RandomForestTrainer(List<FeatureMeta> meta)
Create an instance of RandomForestTrainer.
|
Modifier and Type | Method and Description |
---|---|
protected abstract ModelsComposition |
buildComposition(List<TreeRoot> models)
Returns composition of built trees.
|
protected abstract ImpurityHistogramsComputer<S> |
createImpurityHistogramsComputer()
Creates an instance of Histograms Computer corresponding to RF implementation.
|
protected abstract LeafValuesComputer<L> |
createLeafStatisticsAggregator()
Creates an instance of Leaf Statistics Aggregator corresponding to RF implementation.
|
<K,V> ModelsComposition |
fitWithInitializedDeployingContext(DatasetBuilder<K,V> datasetBuilder,
Preprocessor<K,V> preprocessor)
Trains model based on the specified data.
|
protected boolean |
init(Dataset<EmptyContext,BootstrappedDatasetPartition> dataset)
Init-step before learning.
|
protected ArrayList<TreeRoot> |
initTrees(Queue<TreeNode> treesQueue)
Creates list of trees.
|
protected abstract T |
instance() |
boolean |
isUpdateable(ModelsComposition mdl) |
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.
|
T |
withAmountOfTrees(int amountOfTrees) |
T |
withFeaturesCountSelectionStrgy(Function<List<FeatureMeta>,Integer> strgy) |
T |
withMaxDepth(int maxDepth) |
T |
withMinImpurityDelta(double minImpurityDelta) |
T |
withNodesToLearnSelectionStrgy(Function<Queue<TreeNode>,List<TreeNode>> strgy)
Sets strategy for selection nodes from learning queue in each iteration.
|
T |
withSeed(long seed) |
T |
withSubSampleSize(double subSampleSize) |
fit, fit, fit, fit, fit, fit, getLastTrainedModelOrThrowEmptyDatasetException, identityTrainer, learningEnvironment, update, update, update, update, update, withConvertedLabels, withEnvironmentBuilder
public RandomForestTrainer(List<FeatureMeta> meta)
meta
- Features Meta.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 abstract T instance()
public T withAmountOfTrees(int amountOfTrees)
amountOfTrees
- Count of trees.public T withSubSampleSize(double subSampleSize)
subSampleSize
- Subsample size.public T withMaxDepth(int maxDepth)
maxDepth
- Max depth.public T withMinImpurityDelta(double minImpurityDelta)
minImpurityDelta
- Min impurity delta.public T withFeaturesCountSelectionStrgy(Function<List<FeatureMeta>,Integer> strgy)
strgy
- Strgy.public T withNodesToLearnSelectionStrgy(Function<Queue<TreeNode>,List<TreeNode>> strgy)
strgy
- Strgy.public T withSeed(long seed)
seed
- Seed.protected boolean init(Dataset<EmptyContext,BootstrappedDatasetPartition> dataset)
dataset
- Dataset.public boolean isUpdateable(ModelsComposition mdl)
isUpdateable
in class DatasetTrainer<ModelsComposition,Double>
mdl
- Model.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
.protected abstract ImpurityHistogramsComputer<S> createImpurityHistogramsComputer()
protected abstract LeafValuesComputer<L> createLeafStatisticsAggregator()
protected ArrayList<TreeRoot> initTrees(Queue<TreeNode> treesQueue)
treesQueue
- Trees queue.protected abstract ModelsComposition buildComposition(List<TreeRoot> models)
models
- Models.
GridGain In-Memory Computing Platform : ver. 8.9.14 Release Date : November 5 2024