, 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 by weights. This transformation preserves the order of values in inputs along the specified axis.

  • inputs (Array) – array of any shape whose values will be changed to match those in targets.

  • targets (Array) – sorted array (in ascending order) of dimension 1 describing a discrete distribution. Note: the targets values must be provided as a sorted vector.

  • weights (Optional[Array]) – vector of non-negative weights, summing to \(1\), of the same size as targets. 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 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 object of PointCloud, which defines the ground 1D cost function to transport from inputs to the num_targets target values; epsilon regularization parameter. Remaining kwargs are passed on to parameterize the Sinkhorn solver.

Return type:



An array, which has the same shape as the input, except on the give axis on which the dimension is 1.

  • A ValueError in case the weights and the targets are both set and not of

  • compatible shapes.