org.apache.ignite.ml.tree

## Class DecisionTreeTrainer<T extends ImpurityMeasure<T>>

- java.lang.Object
- - org.apache.ignite.ml.trainers.DatasetTrainer<M,Double>
  - - org.apache.ignite.ml.trainers.SingleLabelDatasetTrainer<DecisionTreeModel>
    - - org.apache.ignite.ml.tree.DecisionTreeTrainer<T>

- Type Parameters:
    `T` - Type of impurity measure.
  Direct Known Subclasses:
    DecisionTreeClassificationTrainer, DecisionTreeRegressionTrainer

      public abstract class DecisionTreeTrainer<T extends ImpurityMeasure<T>>
      extends SingleLabelDatasetTrainer<DecisionTreeModel>

  Distributed decision tree trainer that allows to fit trees using row-partitioned dataset.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.ignite.ml.trainers.DatasetTrainer

      `DatasetTrainer.EmptyDatasetException`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `usingIdx` Use index structure instead of using sorting while learning.

    - ### Fields inherited from class org.apache.ignite.ml.trainers.DatasetTrainer

      `envBuilder, environment`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<K,V> DecisionTreeModel` | `fit(Dataset<EmptyContext,DecisionTreeData> dataset)`
    `<K,V> DecisionTreeModel` | `fitWithInitializedDeployingContext(DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> preprocessor)` Trains model based on the specified data.
    `protected abstract ImpurityMeasureCalculator<T>` | `getImpurityMeasureCalculator(Dataset<EmptyContext,DecisionTreeData> dataset)` Returns impurity measure calculator.
    `boolean` | `isUpdateable(DecisionTreeModel mdl)`
    `static String` | `printTree(DecisionTreeNode node, boolean pretty)` Represents DecisionTree as String.
    `protected <K,V> DecisionTreeModel` | `updateModel(DecisionTreeModel mdl, DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> preprocessor)` Trains new model based on dataset because there is no valid approach to update decision trees.
    `DecisionTreeTrainer<T>` | `withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder)` Changes learning Environment.

    - ### Methods inherited from class org.apache.ignite.ml.trainers.DatasetTrainer

      `fit, fit, fit, fit, fit, fit, getLastTrainedModelOrThrowEmptyDatasetException, identityTrainer, learningEnvironment, update, update, update, update, update, withConvertedLabels`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### usingIdx

          protected boolean usingIdx

      Use index structure instead of using sorting while learning.

  - ### Method Detail

    - #### fitWithInitializedDeployingContext

          public <K,V> DecisionTreeModel fitWithInitializedDeployingContext(DatasetBuilder<K,V> datasetBuilder,
                                                                            Preprocessor<K,V> preprocessor)

      Trains model based on the specified data.
      Specified by:
        `fitWithInitializedDeployingContext` in class `DatasetTrainer<DecisionTreeModel,Double>`
      Type Parameters:
        `K` - Type of a key in `upstream` data.
        `V` - Type of a value in `upstream` data.
      Parameters:
        `datasetBuilder` - Dataset builder.
        `preprocessor` - Extractor of `UpstreamEntry` into `LabeledVector`.
      Returns:
        Model.

    - #### isUpdateable

          public boolean isUpdateable(DecisionTreeModel mdl)

      Specified by:
        `isUpdateable` in class `DatasetTrainer<DecisionTreeModel,Double>`
      Parameters:
        `mdl` - Model.
      Returns:
        True if current critical for training parameters correspond to parameters from last training.

    - #### withEnvironmentBuilder

          public DecisionTreeTrainer<T> withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder)

      Changes learning Environment.
      Overrides:
        `withEnvironmentBuilder` in class `DatasetTrainer<DecisionTreeModel,Double>`
      Parameters:
        `envBuilder` - Learning environment builder.

    - #### updateModel

          protected <K,V> DecisionTreeModel updateModel(DecisionTreeModel mdl,
                                                        DatasetBuilder<K,V> datasetBuilder,
                                                        Preprocessor<K,V> preprocessor)

      Trains new model based on dataset because there is no valid approach to update decision trees.
      Specified by:
        `updateModel` in class `DatasetTrainer<DecisionTreeModel,Double>`
      Type Parameters:
        `K` - Type of a key in `upstream` data.
        `V` - Type of a value in `upstream` data.
      Parameters:
        `mdl` - Learned model.
        `datasetBuilder` - Dataset builder.
        `preprocessor` - Mapper from upstream entry to `LabeledVector`.
      Returns:
        New model based on new dataset.

    - #### fit

          public <K,V> DecisionTreeModel fit(Dataset<EmptyContext,DecisionTreeData> dataset)

    - #### printTree

          public static String printTree(DecisionTreeNode node,
                                         boolean pretty)

      Represents DecisionTree as String.
      Parameters:
        `node` - Decision tree.
        `pretty` - Use pretty mode.

    - #### getImpurityMeasureCalculator

          protected abstract ImpurityMeasureCalculator<T> getImpurityMeasureCalculator(Dataset<EmptyContext,DecisionTreeData> dataset)

      Returns impurity measure calculator.
      Parameters:
        `dataset` - Dataset.
      Returns:
        Impurity measure calculator.

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.13.0
Release Date | : April 20 2022