bundles / scipy latest / scipy / stats / _qmc / scale
function
scipy.stats._qmc:scale
source: build-install/usr/lib/python3.14/site-packages/scipy/stats/_qmc.py:84
Signature
def scale(sample: npt.ArrayLike, l_bounds: npt.ArrayLike, u_bounds: npt.ArrayLike, *, reverse: bool = False) → np.ndarraySummary
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
reverseis True, range of the original data to transform to the unit hypercube.reverse: bool, optionalReverse 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✓
array([[2. , 3.75],
[2. , 2.5 ],
[4. , 1.25]])
And convert back to the unit hypercube:
sample_ = qmc.scale(sample_scaled, l_bounds, u_bounds, reverse=True) sample_✓
array([[0.5 , 0.75],
[0.5 , 0.5 ],
[0.75, 0.25]])
Aliases
scipy.stats._qmc.scale