Copulas is a Python library for modeling multivariate distributions and sampling from them using copula functions. It enables users to learn the dependence structure from tabular numerical data and generate new synthetic data with similar statistical properties, offering various univariate distributions, Archimedian, Gaussian, and Vine Copulas. As part of The Synthetic Data Vault Project by DataCebo, it is actively maintained with regular updates.
pip install copulasVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to load a sample dataset, fit a Gaussian Multivariate Copula model to it, and then generate new synthetic data that statistically resembles the original. It also includes an optional visualization step to compare the real and synthetic data.
Carefully select the copula family based on the data's inherent dependence structure. Consider Archimedian or t-copulas for tail dependence, or Vine copulas for complex, high-dimensional structures. Refer to the official documentation and statistical literature for guidance on model selection.
Preprocess data to ensure all columns are numerical (e.g., one-hot encoding for categorical variables). For time series, consider transforming data (e.g., differencing, log returns) to achieve stationarity before fitting the copula.
Always check the release notes and migration guides when upgrading. For new projects, use the latest stable version. Ensure your Python environment meets the `requires_python` specification (`<3.15,>=3.9`).
Experiment with different copula families and univariate distributions. Use visualization tools (like `copulas.visualization.compare_3d`) and statistical metrics to evaluate the similarity between real and synthetic data. Consult documentation on advanced model selection and evaluation techniques.
Import multivariate and bivariate copula models from their specific submodules. For example, use `from copulas.multivariate import GaussianMultivariate` instead.
Preprocess your data to ensure all columns intended for modeling are numerical. This may involve one-hot encoding categorical features, label encoding, or converting mixed-type columns. Remove or handle missing values appropriately.
Ensure the input data (e.g., `pandas.DataFrame` or `numpy.ndarray`) has the same number of columns (features) as the copula model was originally fitted with, or explicitly define the model for the new dimensionality.
No dependency data recorded yet.