org.apache.ignite.ml.tree.impurity.mse

## Class MSEImpurityMeasure

- java.lang.Object
- - org.apache.ignite.ml.tree.impurity.mse.MSEImpurityMeasure

- All Implemented Interfaces:
    Serializable, Comparable<MSEImpurityMeasure>, ImpurityMeasure<MSEImpurityMeasure>

      public class MSEImpurityMeasure
      extends Object
      implements ImpurityMeasure<MSEImpurityMeasure>

  Mean squared error (variance) impurity measure which is calculated the following way: `\frac{1}{L}\sum_{i=0}^{n}(y_i - \mu)^2`.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MSEImpurityMeasure(double leftY, double leftY2, long leftCnt, double rightY, double rightY2, long rightCnt)` Constructs a new instance of mean squared error (variance) impurity measure.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `MSEImpurityMeasure` | `add(MSEImpurityMeasure b)` Adds the given impurity to this.
    `long` | `getLeftCnt()`
    `double` | `getLeftY()`
    `double` | `getLeftY2()`
    `long` | `getRightCnt()`
    `double` | `getRightY()`
    `double` | `getRightY2()`
    `double` | `impurity()` Calculates impurity measure as a single double value.
    `MSEImpurityMeasure` | `subtract(MSEImpurityMeasure b)` Subtracts the given impurity for this.

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

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

    - ### Methods inherited from interface org.apache.ignite.ml.tree.impurity.ImpurityMeasure

      `compareTo`

- - ### Constructor Detail

    - #### MSEImpurityMeasure

          public MSEImpurityMeasure(double leftY,
                                    double leftY2,
                                    long leftCnt,
                                    double rightY,
                                    double rightY2,
                                    long rightCnt)

      Constructs a new instance of mean squared error (variance) impurity measure.
      Parameters:
        `leftY` - Sum of all elements in the left part.
        `leftY2` - Sum of all squared elements in the left part.
        `leftCnt` - Number of elements in the left part.
        `rightY` - Sum of all elements in the right part.
        `rightY2` - Sum of all squared elements in the right part.
        `rightCnt` - Number of elements in the right part.

  - ### Method Detail

    - #### impurity

          public double impurity()

      Calculates impurity measure as a single double value.
      Specified by:
        `impurity` in interface `ImpurityMeasure<MSEImpurityMeasure>`
      Returns:
        Impurity measure value.

    - #### add

          public MSEImpurityMeasure add(MSEImpurityMeasure b)

      Adds the given impurity to this.
      Specified by:
        `add` in interface `ImpurityMeasure<MSEImpurityMeasure>`
      Parameters:
        `b` - Another impurity.
      Returns:
        Sum of this and the given impurity.

    - #### subtract

          public MSEImpurityMeasure subtract(MSEImpurityMeasure b)

      Subtracts the given impurity for this.
      Specified by:
        `subtract` in interface `ImpurityMeasure<MSEImpurityMeasure>`
      Parameters:
        `b` - Another impurity.
      Returns:
        Difference of this and the given impurity.

    - #### getLeftY

          public double getLeftY()

    - #### getLeftY2

          public double getLeftY2()

    - #### getLeftCnt

          public long getLeftCnt()

    - #### getRightY

          public double getRightY()

    - #### getRightY2

          public double getRightY2()

    - #### getRightCnt

          public long getRightCnt()

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