geolime.geostats.math.anamorphosis¶
Classes:
|
Data:
|
The central part of internal API. |
Functions:
|
Evaluate at x a function determined by its coefficients in the Hermite expansion. |
|
Function to obtain the (standard) Gaussian scores of a sample. |
|
Function to obtain a Gaussian anamorphose model for a sample. |
|
Function to obtain the Hermite coefficients of a Gaussian anamorphose model function. |
|
Computes the Hermite coefficients of a piece-wise linear function continuous in an interval, with a desired extension outside the interval. |
|
Function to obtain the (pseudo-)inverse of a Gaussian anamorphose model for a sample date. |
|
Compute theoretical inverse anamorphosis for a single value. |
-
class
geolime.geostats.math.anamorphosis.
Anamorphosis
(data: numpy.ndarray, data_min: numpy.ndarray = None, data_max: numpy.ndarray = None, weights: numpy.ndarray = None, gauss_scores: numpy.ndarray = None)¶ Bases:
object
Methods:
Compute the gaussian inverse anamorphosis of the input array using a linear interpolation of the gaussian scores.
Compute the gaussian anamorphosis of the input array using a linear interpolation of the gaussian scores.
hermite_coefficients
(n[, error])Function to obtain the Hermite coefficients of a Gaussian anamorphose model function.
Compute the gaussian inverse anamorphosis of the input array using an interpolation with hermite polynomials of the gaussian scores.
theoretical_transform
(x, n)Compute the gaussian anamorphosis of the input array using an interpolation with hermite polynomials of the gaussian scores.
-
empirical_inverse_transform
(x: numpy.ndarray)¶ Compute the gaussian inverse anamorphosis of the input array using a linear interpolation of the gaussian scores.
- Parameters
x (np.ndarray) – Input array containing values in reel space.
- Returns
Transformed array : gaussian values
- Return type
np.ndarray
-
empirical_transform
(x: numpy.ndarray)¶ Compute the gaussian anamorphosis of the input array using a linear interpolation of the gaussian scores.
- Parameters
x (np.ndarray) – Input array containing values in gaussian space.
- Returns
Transformed array : real values
- Return type
np.ndarray
-
hermite_coefficients
(n: int, error: bool = False)¶ Function to obtain the Hermite coefficients of a Gaussian anamorphose model function. The anamorphose used is a continuous piece-wise linear function constructed from the Gaussian scores of the sample data according to weights, together with maximum and minimum optional conditions.
- Parameters
n (int) – Order of the Hermite approximation
error (bool, optional) – If True, the approximation error (L^2 norm with Gaussian weight) will be retourned as a second element of the output list. False by default
- Returns
Array of n values corresponding to hermite coefficients
- Return type
np.ndarray
-
theoretical_inverse_transform
(x: numpy.ndarray, n: int)¶ Compute the gaussian inverse anamorphosis of the input array using an interpolation with hermite polynomials of the gaussian scores. Obtained values are approximates from results of transform gausian values.
- Parameters
x (np.ndarray) – Input array containing values in reel space.
n (int) – Order of the Hermite approximation
- Returns
Transformed array : gaussian values
- Return type
np.ndarray
-
theoretical_transform
(x: numpy.ndarray, n: int)¶ Compute the gaussian anamorphosis of the input array using an interpolation with hermite polynomials of the gaussian scores.
- Parameters
x (np.ndarray) – Input array containing values in gaussian space.
n (int) – Order of the Hermite approximation
- Returns
Transformed array : real values
- Return type
np.ndarray
-
-
geolime.geostats.math.anamorphosis.
gaussian_anamorphosis
(z: numpy.ndarray, yzmin: List = None, yzmax: List = None, weights: numpy.ndarray = None, gauss_scores: numpy.ndarray = None)¶ Function to obtain a Gaussian anamorphose model for a sample. The anamorphose used is a continuous piece-wise linear function constructed from the Gaussian scores of the sample data according to weights, together with maximum and minimum optional conditions.
- Parameters
z (np.ndarray) – numpy array containing the data
yzmin (List, optional) – List of two elements indicating the minimum values expected for the Gaussian scores and the data values, respectively. By default None. If None, the minimum of the Gaussian scores and of the data values are used.
yzmax (List, optional) – List of two elements indicating the maximum values expected for the Gaussian scores and the data values, respectively. By default None. If None, the maximum of the Gaussian scores and of the data values are used.
weights (np.ndarray, optional) – numpy array containing the probability weights associated to each interval defined by the order statisticals of the data in order to determine the Gaussian scores. By default None, which implies uniform probability weights (see gauss_score function).
gauss_scores (np.ndarray, optional) – Option to use the Gaussian scores of the sample as an input directly. By default None. If None, the Gaussian scores will be obtained by this function. If the Gaussian scores are given as an input, they are supposed to be sorted by score. This condition is not verified by this function.
- Returns
A numpy array evaluated function, which is piece-wise linear and continuous.
- Return type
np.ndarray
Deprecated since version 0.1: This will be removed in 0.3. Use the anamorphosis class instead
-
geolime.geostats.math.anamorphosis.
hermite_coefficients_anamorphosis
(n: int, z: numpy.ndarray, yzmin: List = None, yzmax: List = None, weights: numpy.ndarray = None, gauss_scores: numpy.ndarray = None, sort: bool = True, error: bool = False)¶ Function to obtain the Hermite coefficients of a Gaussian anamorphose model function. The anamorphose used is a continuous piece-wise linear function constructed from the Gaussian scores of the sample data according to weights, together with maximum and minimum optional conditions.
- Parameters
n (int) – integer determining the order of the Hermite approximation
z (np.ndarray) – numpy array containing the data
yzmin (List, optional) – List of two elements indicating the minimum values expected for the Gaussian scores and the data values, respectively. By default None. If None, the minimum of the Gaussian scores and of the data values are used.
yzmax (List, optional) – List of two elements indicating the maximum values expected for the Gaussian scores and the data values, respectively. By default None. If None, the maximum of the Gaussian scores and of the data values are used.
weights (np.ndarray, optional) – numpy array containing the probability weights associated to each interval defined by the order statisticals of the data in order to determine the Gaussian scores. By default None, which implies uniform probability weights (see gauss_score function).
gauss_scores (np.ndarray, optional) – Option to use the Gaussian scores of the sample as an input directly. By default None. If None, the Gaussian scores will be obtained by this function.If the Gaussian scores are given as an input, they are supposed to be sorted by score. This condition is not verified by this function.
sort (bool, optional) – Indicates if z values are sorted. True by default.
error (bool, optional) – boolean (by default False). If True, the approximation error (L^2 norm with Gaussian weight) will be retourned as a second element of the output list.
- Returns
a numpy array conatining the first coefficients of the Hermite expansion of the anamorphose. if Error=True, a list, the first element containing the coefficients (previous output) and the second containing the error of the Hermite approximation.
- Return type
np.ndarray
Deprecated since version 0.1: This will be removed in 0.3. Use the anamorphosis class instead
-
geolime.geostats.math.anamorphosis.
inverse_anamorphosis_from_obs
(z: numpy.ndarray, yzmin: List = None, yzmax: List = None, weights: numpy.ndarray = None, gauss_scores: numpy.ndarray = None)¶ Function to obtain the (pseudo-)inverse of a Gaussian anamorphose model for a sample date. The anamorphose used is a continuous piece-wise linear function constructed from the Gaussian scores of the sample data according to weights, together with maximum and minimum optional conditions. If there are no two equal data-values, the anamorphose is bijective over the interval determined by the minimum and maximum scores. This function obtains hence the inverse in this interval. Outside this interval every value is associated to the theoretical minimal or maximal data value.
- Parameters
z (np.ndarray) – numpy array containing the data
yzmin (List, optional) – List of two elements indicating the minimum values expected for the Gaussian scores and the data values, respectively. By default None. If None, the minimum of the Gaussian scores and of the data values are used.
yzmax (List, optional) – List of two elements indicating the maximum values expected for the Gaussian scores and the data values, respectively. By default None. If None, the maximum of the Gaussian scores and of the data values are used.
weights (np.ndarray, optional) – numpy array containing the probability weights associated to each interval defined by the order statisticals of the data in order to determine the Gaussian scores. By default None, which implies uniform probability weights (see gauss_score function).
gauss_scores (np.ndarray, optional) – Option to use the Gaussian scores of the sample as an input directly. By default None. If None, the Gaussian scores will be obtained by this function. If the Gaussian scores are given as an input, they are supposed to be sorted by score. This condition is not verified by this function.
- Returns
a numpy array evaluated function, which is piece-wise linear and continuous, corresponding to the inverse of the anamorphose function in the bijectivity interval.
- Return type
np.ndarray
Deprecated since version 0.1: This will be removed in 0.3. Use the anamorphosis class instead
-
geolime.geostats.math.anamorphosis.
inverse_anamorphosis_theoretical
(z: numpy.ndarray, anam: numpy.ndarray, ymin: float = - 4.5, ymax: float = 4.5, nlag: int = 200)¶ Compute theoretical inverse anamorphosis for a single value. The obtained value is an approximation and its accuracy depends on the number of lags.
- Parameters
z (np.ndarray) – Estimation array
anam (np.ndarray) – anamorphosis array
ymin (float, optional) – Minimum boundary for sampling. By default -4.5 corresponding to minimum threshold for 99,997% of gaussian distribution
ymax (float, optional) – Maximum boundary for sampling By default 4.5 corresponding to maximum threshold for 99,997% of gaussian distribution
nlag (int, optional) – Sampling lags By default 200.
- Returns
Inverse anamorphis of input value
- Return type
np.ndarray
Deprecated since version 0.1: This will be removed in 0.3. Use the anamorphosis class instead