org.apache.ignite.ml.tree.impurity

## Class ImpurityMeasureCalculator<T extends ImpurityMeasure<T>>

- java.lang.Object
- - org.apache.ignite.ml.tree.impurity.ImpurityMeasureCalculator<T>

- Type Parameters:
    `T` - Type of impurity measure.
  All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    GiniImpurityMeasureCalculator, MSEImpurityMeasureCalculator

      public abstract class ImpurityMeasureCalculator<T extends ImpurityMeasure<T>>
      extends Object
      implements Serializable

  Base interface for impurity measure calculators that calculates all impurity measures required to find a best split.
  See Also:
    Serialized Form

- - ### Field Summary

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

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ImpurityMeasureCalculator(boolean useIdx)` Constructs an instance of ImpurityMeasureCalculator.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract StepFunction<T>[]` | `calculate(DecisionTreeData data, TreeFilter filter, int depth)` Calculates all impurity measures required required to find a best split and returns them as an array of `StepFunction` (for every column).
    `protected int` | `columnsCount(DecisionTreeData data, TreeDataIndex idx)` Returns columns count in current dataset.
    `protected double` | `getFeatureValue(DecisionTreeData data, TreeDataIndex idx, int featureId, int k)` Returns feature value in according to kth order statistic.
    `protected Vector` | `getFeatureValues(DecisionTreeData data, TreeDataIndex idx, int featureId, int k)` Returns feature value in according to kth order statistic.
    `protected double` | `getLabelValue(DecisionTreeData data, TreeDataIndex idx, int featureId, int k)` Returns label value in according to kth order statistic.
    `protected int` | `rowsCount(DecisionTreeData data, TreeDataIndex idx)` Returns rows count in current dataset.

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

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

- - ### Field Detail

    - #### useIdx

          protected final boolean useIdx

      Use index structure instead of using sorting while learning.

  - ### Constructor Detail

    - #### ImpurityMeasureCalculator

          public ImpurityMeasureCalculator(boolean useIdx)

      Constructs an instance of ImpurityMeasureCalculator.
      Parameters:
        `useIdx` - Use index.

  - ### Method Detail

    - #### calculate

          public abstract StepFunction<T>[] calculate(DecisionTreeData data,
                                                      TreeFilter filter,
                                                      int depth)

      Calculates all impurity measures required required to find a best split and returns them as an array of `StepFunction` (for every column).
      Parameters:
        `data` - Features and labels.
      Returns:
        Impurity measures as an array of `StepFunction` (for every column).

    - #### columnsCount

          protected int columnsCount(DecisionTreeData data,
                                     TreeDataIndex idx)

      Returns columns count in current dataset.
      Parameters:
        `data` - Data.
        `idx` - Index.
      Returns:
        Columns count in current dataset.

    - #### rowsCount

          protected int rowsCount(DecisionTreeData data,
                                  TreeDataIndex idx)

      Returns rows count in current dataset.
      Parameters:
        `data` - Data.
        `idx` - Index.
      Returns:
        rows count in current dataset

    - #### getLabelValue

          protected double getLabelValue(DecisionTreeData data,
                                         TreeDataIndex idx,
                                         int featureId,
                                         int k)

      Returns label value in according to kth order statistic.
      Parameters:
        `data` - Data.
        `idx` - Index.
        `featureId` - Feature id.
        `k` - K-th statistic.
      Returns:
        label value in according to kth order statistic

    - #### getFeatureValue

          protected double getFeatureValue(DecisionTreeData data,
                                           TreeDataIndex idx,
                                           int featureId,
                                           int k)

      Returns feature value in according to kth order statistic.
      Parameters:
        `data` - Data.
        `idx` - Index.
        `featureId` - Feature id.
        `k` - K-th statistic.
      Returns:
        feature value in according to kth order statistic.

    - #### getFeatureValues

          protected Vector getFeatureValues(DecisionTreeData data,
                                            TreeDataIndex idx,
                                            int featureId,
                                            int k)

      Returns feature value in according to kth order statistic.
      Parameters:
        `data` - Data.
        `idx` - Index.
        `featureId` - Feature id.
        `k` - K-th statistic.
      Returns:
        feature value in according to kth order statistic.

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