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
targets
weighted byweights
. This transformation preserves the order of values ininputs
along 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: thetargets
values 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 ininputs
to lie in \([0,1]\) (sigmoid of whitened values by default) to solve the optimal transport problem;cost_fn
object ofPointCloud
, which defines the ground 1D cost function to transport frominputs
to thenum_targets
target values;epsilon
regularization parameter. Remainingkwargs
are passed on to parameterize theSinkhorn
solver.
- 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. –