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 DatasetTrainer<ModelsComposition,Double>
DatasetTrainer.EmptyDatasetException
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 boolean |
checkState(ModelsComposition mdl) |
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 |
fit(DatasetBuilder<K,V> datasetBuilder,
IgniteBiFunction<K,V,Vector> featureExtractor,
IgniteBiFunction<K,V,Double> lbExtractor)
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() |
protected <K,V> ModelsComposition |
updateModel(ModelsComposition mdl,
DatasetBuilder<K,V> datasetBuilder,
IgniteBiFunction<K,V,Vector> featureExtractor,
IgniteBiFunction<K,V,Double> lbExtractor)
Gets state of model in arguments, update in according to new data and return new model.
|
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, getLastTrainedModelOrThrowEmptyDatasetException, setEnvironment, update, update, update, update, update
public RandomForestTrainer(List<FeatureMeta> meta)
meta
- Features Meta.public <K,V> ModelsComposition fit(DatasetBuilder<K,V> datasetBuilder, IgniteBiFunction<K,V,Vector> featureExtractor, IgniteBiFunction<K,V,Double> lbExtractor)
fit
in class DatasetTrainer<ModelsComposition,Double>
K
- Type of a key in upstream
data.V
- Type of a value in upstream
data.datasetBuilder
- Dataset builder.featureExtractor
- Feature extractor.lbExtractor
- Label extractor.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.protected boolean checkState(ModelsComposition mdl)
checkState
in class DatasetTrainer<ModelsComposition,Double>
mdl
- Model.protected <K,V> ModelsComposition updateModel(ModelsComposition mdl, DatasetBuilder<K,V> datasetBuilder, IgniteBiFunction<K,V,Vector> featureExtractor, IgniteBiFunction<K,V,Double> lbExtractor)
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.featureExtractor
- Feature extractor.lbExtractor
- Label extractor.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.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.7.2 Release Date : February 6 2019