{ } Raw JSON

bundles / scipy 1.17.1 / scipy / stats / _qmc / scale

function

scipy.stats._qmc:scale

source: /scipy/stats/_qmc.py :88

Signature

def   scale ( sample : npt.ArrayLike l_bounds : npt.ArrayLike u_bounds : npt.ArrayLike * reverse : bool = False )  →  np.ndarray

Summary

Sample scaling from unit hypercube to different bounds.

Extended Summary

To convert a sample from to , with the lower bounds and the upper bounds. The following transformation is used:

Parameters

sample : array_like (n, d)

Sample to scale.

l_bounds, u_bounds : array_like (d,)

Lower and upper bounds (resp. , ) of transformed data. If reverse is True, range of the original data to transform to the unit hypercube.

reverse : bool, optional

Reverse the transformation from different bounds to the unit hypercube. Default is False.

Returns

sample : array_like (n, d)

Scaled sample.

Examples

Transform 3 samples in the unit hypercube to bounds:
from scipy.stats import qmc
l_bounds = [-2, 0]
u_bounds = [6, 5]
sample = [[0.5 , 0.75],
          [0.5 , 0.5],
          [0.75, 0.25]]
sample_scaled = qmc.scale(sample, l_bounds, u_bounds)
sample_scaled
And convert back to the unit hypercube:
sample_ = qmc.scale(sample_scaled, l_bounds, u_bounds, reverse=True)
sample_

Aliases

  • scipy.stats._qmc.scale

Referenced by

This package