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

## Class MSEHistogram

- java.lang.Object
- - org.apache.ignite.ml.tree.randomforest.data.impurity.ImpurityHistogram
  - - org.apache.ignite.ml.tree.randomforest.data.impurity.MSEHistogram

- All Implemented Interfaces:
    Serializable, Histogram<BootstrappedVector,MSEHistogram>, ImpurityComputer<BootstrappedVector,MSEHistogram>

      public class MSEHistogram
      extends ImpurityHistogram
      implements ImpurityComputer<BootstrappedVector,MSEHistogram>

  Class contains implementation of splitting point finding algorithm based on MSE metric (see https://en.wikipedia.org/wiki/Mean_squared_error) and represents a set of histograms in according to this metric.
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.apache.ignite.ml.tree.randomforest.data.impurity.ImpurityHistogram

      `bucketIds, featureId`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MSEHistogram(int sampleId, BucketMeta bucketMeta)` Creates an instance of MSEHistogram.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addElement(BootstrappedVector vector)` Add object to histogram.
    `Set<Integer>` | `buckets()`
    `Optional<NodeSplit>` | `findBestSplit()` Returns best split point computed on histogram if it exists.
    `Optional<Double>` | `getValue(Integer bucketId)`
    `boolean` | `isEqualTo(MSEHistogram other)` Compares histogram with other and returns true if they are equals
    `MSEHistogram` | `plus(MSEHistogram other)`

    - ### Methods inherited from class org.apache.ignite.ml.tree.randomforest.data.impurity.ImpurityHistogram

      `checkAndReturnSplitValue`

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

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

- - ### Constructor Detail

    - #### MSEHistogram

          public MSEHistogram(int sampleId,
                              BucketMeta bucketMeta)

      Creates an instance of MSEHistogram.
      Parameters:
        `sampleId` - Sample id.
        `bucketMeta` - Bucket meta.

  - ### Method Detail

    - #### addElement

          public void addElement(BootstrappedVector vector)

      Add object to histogram.
      Specified by:
        `addElement` in interface `Histogram<BootstrappedVector,MSEHistogram>`
      Parameters:
        `vector` - Value.

    - #### plus

          public MSEHistogram plus(MSEHistogram other)

      Specified by:
        `plus` in interface `Histogram<BootstrappedVector,MSEHistogram>`
      Parameters:
        `other` - Other histogram.
      Returns:
        Sum of this and other histogram.

    - #### buckets

          public Set<Integer> buckets()

      Specified by:
        `buckets` in interface `Histogram<BootstrappedVector,MSEHistogram>`
      Returns:
        Bucket ids.

    - #### getValue

          public Optional<Double> getValue(Integer bucketId)

      Specified by:
        `getValue` in interface `Histogram<BootstrappedVector,MSEHistogram>`
      Parameters:
        `bucketId` - Bucket id.
      Returns:
        Value in according to bucket id.

    - #### findBestSplit

          public Optional<NodeSplit> findBestSplit()

      Returns best split point computed on histogram if it exists. Split point may be absent when there is no data in histograms or split point lay in last bucket in histogram.
      Specified by:
        `findBestSplit` in interface `ImpurityComputer<BootstrappedVector,MSEHistogram>`
      Returns:
        Splitting point for decision tree.

    - #### isEqualTo

          public boolean isEqualTo(MSEHistogram other)

      Compares histogram with other and returns true if they are equals
      Specified by:
        `isEqualTo` in interface `Histogram<BootstrappedVector,MSEHistogram>`
      Parameters:
        `other` - Other histogram.
      Returns:
        True if histograms are equal.

${current.year} Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.15.0
Release Date | : April 25 2023