ott.tools.soft_sort.quantile_normalization#

ott.tools.soft_sort.quantile_normalization(inputs, targets, weights=None, axis=-1, **kwargs)[source]#

Renormalize inputs so that its quantiles match those of targets/weights.

The idea of quantile normalization is to map the inputs to values so that the distribution of transformed values matches the distribution of target values. In a sense, we want to keep the inputs in the same order, but apply the values of the target.

Parameters:
  • inputs (Array) – the inputs array of any shape.

  • targets (Array) – the target values of dimension 1. The targets must be sorted.

  • weights (Optional[Array]) – if set, the weights or the target.

  • axis (int) – the axis along which to apply the transformation on the inputs.

  • kwargs – keyword arguments passed on to lower level functions. Of interest to the user are squashing_fun, which will redistribute the values in inputs to lie in [0,1] (sigmoid of whitened values by default) to solve the optimal transport problem; cost_fn, used in PointCloud, that defines the ground cost function to transport from inputs to the num_targets target values (squared Euclidean distance by default, see pointcloud.py for more details); epsilon values as well as other parameters to shape the sinkhorn algorithm.

Return type:

Array

Returns:

A jnp.ndarray, 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.