org.apache.ignite.ml.dataset.feature

## Class ObjectHistogram<T>

- java.lang.Object
- - org.apache.ignite.ml.dataset.feature.ObjectHistogram<T>

- Type Parameters:
    `T` - Type of object for histogram.
  All Implemented Interfaces:
    Serializable, DistributionComputer, Histogram<T,ObjectHistogram<T>>
  Direct Known Subclasses:
    BootstrappedVectorsHistogram

      public abstract class ObjectHistogram<T>
      extends Object
      implements Histogram<T,ObjectHistogram<T>>, DistributionComputer

  Basic implementation of `Histogram` that implements also `DistributionComputer`.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ObjectHistogram()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addElement(T val)` Add object to histogram.
    `Set<Integer>` | `buckets()`
    `TreeMap<Integer,Double>` | `computeDistributionFunction()` Compute distribution function.
    `Optional<Double>` | `getValue(Integer bucketId)`
    `boolean` | `isEqualTo(ObjectHistogram<T> other)` Compares histogram with other and returns true if they are equals
    `abstract Integer` | `mapToBucket(T obj)` Bucket mapping.
    `abstract Double` | `mapToCounter(T obj)` Counter mapping.
    `abstract ObjectHistogram<T>` | `newInstance()` Creates an instance of ObjectHistogram from child class.
    `ObjectHistogram<T>` | `plus(ObjectHistogram<T> other)`

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

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

- - ### Constructor Detail

    - #### ObjectHistogram

          public ObjectHistogram()

  - ### Method Detail

    - #### addElement

          public void addElement(T val)

      Add object to histogram.
      Specified by:
        `addElement` in interface `Histogram<T,ObjectHistogram<T>>`
      Parameters:
        `val` - Value.

    - #### buckets

          public Set<Integer> buckets()

      Specified by:
        `buckets` in interface `Histogram<T,ObjectHistogram<T>>`
      Returns:
        Bucket ids.

    - #### getValue

          public Optional<Double> getValue(Integer bucketId)

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

    - #### computeDistributionFunction

          public TreeMap<Integer,Double> computeDistributionFunction()

      Compute distribution function.
      Specified by:
        `computeDistributionFunction` in interface `DistributionComputer`
      Returns:
        Map represents discrete distribution function.

    - #### plus

          public ObjectHistogram<T> plus(ObjectHistogram<T> other)

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

    - #### isEqualTo

          public boolean isEqualTo(ObjectHistogram<T> other)

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

    - #### mapToBucket

          public abstract Integer mapToBucket(T obj)

      Bucket mapping.
      Parameters:
        `obj` - Object.
      Returns:
        BucketId.

    - #### mapToCounter

          public abstract Double mapToCounter(T obj)

      Counter mapping.
      Parameters:
        `obj` - Object.
      Returns:
        Counter.

    - #### newInstance

          public abstract ObjectHistogram<T> newInstance()

      Creates an instance of ObjectHistogram from child class.
      Returns:
        Object histogram.

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