copulas.multivariate.base module

Base Multivariate class.

class copulas.multivariate.base.Multivariate(random_state=None)[source]

Bases: object

Abstract class for a multi-variate copula object.

cdf(X)[source]

Compute the cumulative distribution value for each point in X.

Parameters

X (pandas.DataFrame) – Values for which the cumulative distribution will be computed.

Returns

Cumulative distribution values for points in X.

Return type

numpy.ndarray

Raises

NotFittedError – if the model is not fitted.

check_fit()[source]

Check whether this model has already been fit to a random variable.

Raise a NotFittedError if it has not.

Raises

NotFittedError – if the model is not fitted.

cumulative_distribution(X)[source]

Compute the cumulative distribution value for each point in X.

Parameters

X (pandas.DataFrame) – Values for which the cumulative distribution will be computed.

Returns

Cumulative distribution values for points in X.

Return type

numpy.ndarray

Raises

NotFittedError – if the model is not fitted.

fit(X)[source]

Fit the model to table with values from multiple random variables.

Parameters

X (pandas.DataFrame) – Values of the random variables.

fitted = False
classmethod from_dict(params)[source]

Create a new instance from a parameters dictionary.

Parameters

params (dict) – Parameters of the distribution, in the same format as the one returned by the to_dict method.

Returns

Instance of the distribution defined on the parameters.

Return type

Multivariate

classmethod load(path)[source]

Load a Multivariate instance from a pickle file.

Parameters

path (str) – Path to the pickle file where the distribution has been serialized.

Returns

Loaded instance.

Return type

Multivariate

log_probability_density(X)[source]

Compute the log of the probability density for each point in X.

Parameters

X (pandas.DataFrame) – Values for which the log probability density will be computed.

Returns

Log probability density values for points in X.

Return type

numpy.ndarray

Raises

NotFittedError – if the model is not fitted.

pdf(X)[source]

Compute the probability density for each point in X.

Parameters

X (pandas.DataFrame) – Values for which the probability density will be computed.

Returns

Probability density values for points in X.

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 (pandas.DataFrame) – Values for which the probability density will be computed.

Returns

Probability density values for points in X.

Return type

numpy.ndarray

Raises

NotFittedError – if the model is not fitted.

sample(num_rows=1)[source]

Sample values from this model.

Argument:
num_rows (int):

Number of rows to sample.

Returns

Array of shape (n_samples, *) with values randomly sampled from this model distribution.

Return type

numpy.ndarray

Raises

NotFittedError – if the model is not fitted.

save(path)[source]

Serialize this multivariate instance using pickle.

Parameters

path (str) – Path to where this distribution will be serialized.

set_random_state(random_state)[source]

Set the random state.

Parameters

random_state (int, np.random.RandomState, or None) – Seed or RandomState for the random generator.

to_dict()[source]

Return a dict with the parameters to replicate this object.

Returns

Parameters of this distribution.

Return type

dict