ott.tools.soft_sort.quantile_normalization#
- ott.tools.soft_sort.quantile_normalization(inputs, targets, weights=None, axis=-1, **kwargs)[source]#
Re-normalize inputs so that its quantiles match those of targets/weights.
Quantile normalization rearranges the values in inputs to values that match the distribution of values described in the discrete distribution
targetsweighted byweights. This transformation preserves the order of values ininputsalong the specifiedaxis.- Parameters:
inputs (
Array) – array of any shape whose values will be changed to match those intargets.targets (
Array) – sorted array (in ascending order) of dimension 1 describing a discrete distribution. Note: thetargetsvalues must be provided as a sorted vector.weights (
Optional[Array]) – vector of non-negative weights, summing to \(1\), of the same size astargets. When not set, this defaults to the uniform distribution.axis (
int) – the axis along which the quantile transformation is applied.kwargs (
Any) – keyword arguments passed on to lower level functions. Of interest to the user aresquashing_fun, which will redistribute the values ininputsto lie in \([0,1]\) (sigmoid of whitened values by default) to solve the optimal transport problem;cost_fnobject ofPointCloud, which defines the ground 1D cost function to transport frominputsto thenum_targetstarget values;epsilonregularization parameter. Remainingkwargsare passed on to parameterize theSinkhornsolver.
- Return type:
- Returns:
An array, which has the same shape as the input, except on the give axis on which the dimension is 1.
- Raises:
A ValueError in case the weights and the targets are both set and not of –
compatible shapes. –