org.apache.ignite.ml.tree.randomforest.data.statistics

## Class LeafValuesComputer<T>

- java.lang.Object
- - org.apache.ignite.ml.tree.randomforest.data.statistics.LeafValuesComputer<T>

- Type Parameters:
    `T` - Type of leaf statistic.
  All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    ClassifierLeafValuesComputer, RegressionLeafValuesComputer

      public abstract class LeafValuesComputer<T>
      extends Object
      implements Serializable

  Class containing logic of leaf values computing after building of all trees in random forest.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LeafValuesComputer()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract void` | `addElementToLeafStatistic(T leafStatAggr, BootstrappedVector vec, int sampleId)` Save vector to leaf statistic.
    `protected abstract double` | `computeLeafValue(T stat)` Compute value from leaf based on statistics on labels corresponds to leaf.
    `protected abstract T` | `createLeafStatsAggregator(int sampleId)` Creates an instance of leaf statistics aggregator in according to concrete algorithm based on RandomForest.
    `protected abstract T` | `mergeLeafStats(T leftStats, T rightStats)` Merge statistics for same leafs.
    `void` | `setValuesForLeaves(ArrayList<RandomForestTreeModel> roots, Dataset<EmptyContext,BootstrappedDatasetPartition> dataset)` Takes a list of all built trees and in one map-reduceImpurityStatistics step collect statistics for evaluating leaf-values for each tree and sets values for leaves.

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

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

- - ### Constructor Detail

    - #### LeafValuesComputer

          public LeafValuesComputer()

  - ### Method Detail

    - #### setValuesForLeaves

          public void setValuesForLeaves(ArrayList<RandomForestTreeModel> roots,
                                         Dataset<EmptyContext,BootstrappedDatasetPartition> dataset)

      Takes a list of all built trees and in one map-reduceImpurityStatistics step collect statistics for evaluating leaf-values for each tree and sets values for leaves.
      Parameters:
        `roots` - Learned trees.
        `dataset` - Dataset.

    - #### addElementToLeafStatistic

          protected abstract void addElementToLeafStatistic(T leafStatAggr,
                                                            BootstrappedVector vec,
                                                            int sampleId)

      Save vector to leaf statistic.
      Parameters:
        `leafStatAggr` - Leaf statistics aggregator.
        `vec` - Vector.
        `sampleId` - Sample id.

    - #### mergeLeafStats

          protected abstract T mergeLeafStats(T leftStats,
                                              T rightStats)

      Merge statistics for same leafs.
      Parameters:
        `leftStats` - First leaf stat aggregator.
        `rightStats` - Second leaf stat aggregator.

    - #### createLeafStatsAggregator

          protected abstract T createLeafStatsAggregator(int sampleId)

      Creates an instance of leaf statistics aggregator in according to concrete algorithm based on RandomForest.
      Parameters:
        `sampleId` - Sample id.

    - #### computeLeafValue

          protected abstract double computeLeafValue(T stat)

      Compute value from leaf based on statistics on labels corresponds to leaf.
      Parameters:
        `stat` - Leaf statistics.

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.12.0
Release Date | : January 10 2022