Package ucar.unidata.data.grid
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 Summary
ConstructorsConstructorDescriptionQuantileTransformer
(int nQuantiles, int subsample) Create an empty quantile transformer with the specified number of quantiles and subsample.QuantileTransformer
(int nQuantiles, int subsample, double[] references, double[] quantiles) Construct a quantile transformer from an existing internal representation. -
Method Summary
-
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 quantilessubsample
- 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 quantilessubsample
- Number of subsamplesreferences
- The referencesquantiles
- 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 incompareTo==0
withtransformer
then the cached object will be returned. Otherwisetransformer
will be returned.
Instead of making theQuantileTransformer
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
-
getColInputCount
public int getColInputCount() -
getColOutputCount
public int getColOutputCount() -
shutdown
public void shutdown() -
compareTo
- Specified by:
compareTo
in interfaceComparable<GridUtil.QuantileTransformer>
-