chaospy.approximate_inverse¶
- chaospy.approximate_inverse(distribution, idx, qloc, bounds=None, cache=None, parameters=None, xloc0=None, iterations=300, tolerance=1e-12)[source]¶
Calculate the approximation of the inverse Rosenblatt transformation.
Uses a hybrid Newton-Raphson and binary search method to converge to the inverse values. Includes forward Rosenblatt transformations, probability density function (its derivative), and if not provided, boundary function.
- Args:
- distribution (Distribution):
Distribution to estimate inverse Rosenblatt on.
- idx (int):
The dimension to take approximation along.
- qloc (numpy.ndarray):
Input values. All values must be on unit interval
(0, 1)
andqloc.shape == (dim,size)
where dim is the number of dimensions in distribution and size is the number of values to calculate simultaneously.- bounds (Optional[Tuple[numpy.ndarray, numpy.ndarray]]):
Assuming lower and upper bounds is not available, this provides outer bounds for lower and upper to use instead.
- cache (Optional[Dict[Distribution, numpy.ndarray]]):
Memory cache for the location in the evaluation so far.
- parameters (Optional[Dict[str, Any]]):
The parameters to use. If omitted, get the parameters from distribution.
- iterations (int):
The maximum number of iterations allowed.
- tolerance (float):
Tolerance criterion determining convergence.
- Returns:
- (numpy.ndarray):
Approximation of inverse Rosenblatt transformation.
- Example:
>>> distribution = chaospy.Normal(1000, 10) >>> qloc = numpy.array([0.1, 0.2, 0.9]) >>> inverse = distribution.inv(qloc) >>> inverse.round(4) array([ 987.1845, 991.5838, 1012.8155]) >>> distribution._ppf = None >>> numpy.allclose( ... approximate_inverse(distribution, 0, qloc), inverse) True