copulas.univariate.gaussian_kde module
GaussianKDE module.
- class copulas.univariate.gaussian_kde.GaussianKDE(sample_size=None, random_state=None, bw_method=None, weights=None)[source]
Bases:
ScipyModelA wrapper for gaussian Kernel density estimation.
It was implemented in scipy.stats toolbox. gaussian_kde is slower than statsmodels but allows more flexibility.
When a sample_size is provided the fit method will sample the data, and mask the real information. Also, ensure the number of entries will be always the value of sample_size.
- Parameters:
sample_size (int) – amount of parameters to sample
- BOUNDED = 0
- MODEL_CLASS
alias of
gaussian_kde
- PARAMETRIC = 0
- cumulative_distribution(X)[source]
Compute the cumulative distribution value for each point in X.
- Parameters:
X (numpy.ndarray) – Values for which the cumulative distribution will be computed. It must have shape (n, 1).
- Returns:
Cumulative distribution values for points in X.
- Return type:
numpy.ndarray
- Raises:
NotFittedError – if the model is not fitted.
- percent_point(U, method='chandrupatla')[source]
Compute the inverse cumulative distribution value for each point in U.
- Parameters:
U (numpy.ndarray) – Values for which the cumulative distribution will be computed. It must have shape (n, 1) and values must be in [0,1].
method (str) – Whether to use the chandrupatla or bisect solver.
- Returns:
Inverse cumulative distribution values for points in U.
- Return type:
numpy.ndarray
- Raises:
NotFittedError – if the model is not fitted.
- probability_density(X)[source]
Compute the probability density for each point in X.
- Parameters:
X (numpy.ndarray) – Values for which the probability density will be computed. It must have shape (n, 1).
- Returns:
Probability density values for points in X.
- Return type:
numpy.ndarray
- Raises:
NotFittedError – if the model is not fitted.
- sample(n_samples=1)[source]
Sample values from this model.
- Argument:
- n_samples (int):
Number of values to sample
- Returns:
Array of shape (n_samples, 1) with values randomly sampled from this model distribution.
- Return type:
numpy.ndarray
- Raises:
NotFittedError – if the model is not fitted.