Class GridUtil.QuantileTransformer

java.lang.Object
ucar.unidata.data.grid.GridUtil.QuantileTransformer
All Implemented Interfaces:
Serializable, Comparable<GridUtil.QuantileTransformer>
Enclosing class:
GridUtil

public static class GridUtil.QuantileTransformer extends Object implements Serializable, Comparable<GridUtil.QuantileTransformer>
See Also:
  • Constructor Details

    • QuantileTransformer

      public QuantileTransformer(int nQuantiles, int subsample)
      Create an empty quantile transformer with the specified number of quantiles and subsample.
      Parameters:
      nQuantiles - Number of quantiles
      subsample - Number of subsamples
    • QuantileTransformer

      public QuantileTransformer(int nQuantiles, int subsample, double[] references, double[] quantiles)
      Construct a quantile transformer from an existing internal representation.

      Only not use this constructor if you have the internal state of an existing quantile transformer!

      This constructor is useful from porting a scikit-learn sklearn.preprocessing.QuantileTransformer since the implementations share the same internal objects.
      Parameters:
      nQuantiles - Number of quantiles
      subsample - Number of subsamples
      references - The references
      quantiles - The quantiles
  • Method Details

    • getQuantileTransformerFromCache

      public GridUtil.QuantileTransformer getQuantileTransformerFromCache(GridUtil.QuantileTransformer transformer)
      Stores transformers in a private cache. When an existing transformer is found that results in compareTo==0 with transformer then the cached object will be returned. Otherwise transformer will be returned.

      Instead of making the QuantileTransformer constructor private, set your local transformer to the result of this cache method to prevent duplicating transformers in memory.

      The implementation synchronizes on the transformer cache so this method is thread-safe.
      Parameters:
      transformer - The transformer
      Returns:
      A cached copy of the transformer
    • clearCache

      public void clearCache()
      Clears the cache of transformers.

      The implementation synchronizes on the transformer cache so this method is thread-safe.
    • fit

      public <I> void fit(I x)
    • transform

      public <I, O> O transform(I x, Class<O> returnType, boolean rowMajorOrder)
    • getColInputCount

      public int getColInputCount()
    • getColOutputCount

      public int getColOutputCount()
    • shutdown

      public void shutdown()
    • compareTo

      public int compareTo(GridUtil.QuantileTransformer other)
      Specified by:
      compareTo in interface Comparable<GridUtil.QuantileTransformer>