Package: copulas
This repository is part ofThe Synthetic Data Vault Project, a project fromDataCebo.OverviewCopulasis a Python library for modeling multivariate distributions and sampling from them
using copula functions.
Given a table of numerical data, use Copulas to learn the distribution and
generate new synthetic data following the same statistical properties.Key Features:Model multivariate data.Choose from a variety of univariate
distributions and copulas – including Archimedian Copulas, Gaussian Copulas and Vine Copulas.Compare real and synthetic data visuallyafter building your model. Visualizations
are available as 1D histograms, 2D scatterplots and 3D scatterplots.Access & manipulate learned parameters.With complete access to the internals
of the model, set or tune parameters to your choosing.InstallInstall the Copulas library using pip or conda.pipinstallcopulascondainstall-cconda-forgecopulasUsageGet started using a demo dataset. This dataset contains 3 numerical columns.fromcopulas.datasetsimportsample_trivariate_xyzreal_data=sample_trivariate_xyz()real_data.head()Model the data using a copula and use it to create synthetic data.
The Copulas library offers many options including Gaussian Copula,
Vine Copulas and Archimedian Copulas.fromcopulas.multivariateimportGaussianMultivariatecopula=GaussianMultivariate()copula.fit(real_data)synthetic_data=copula.sample(len(real_data))Visualize the real and synthetic data side-by-side. Let's do this in 3D so see our full dataset.fromcopulas.visualizationimportcompare_3dcompare_3d(real_data,synthetic_data)TutorialsClick below to run the code yourself on a Colab Notebook and discover new features.Community & SupportLearn more about Copulas library from ourdocumentationsite.Questions or issues?Join ourSlack channelto discuss more about Copulas and synthetic data.
If you find a bug or have a feature request, you can alsoopen an issueon our GitHub.Interested in contributing to Copulas?Read ourContribution Guideto get started.CreditsThe Copulas open source project first started at the Data to AI Lab at MIT in 2018.
Thank you to our team of contributors who have built and maintained the library over the years!View ContributorsThe Synthetic Data Vault Projectwas first created at MIT'sData to AI Labin 2016. After 4 years of research and traction with enterprise, we
createdDataCeboin 2020 with the goal of growing the project.
Today, DataCebo is the proud developer of SDV, the largest ecosystem for
synthetic data generation & evaluation. It is home to multiple libraries that support synthetic
data, including:🔄 Data discovery & transformation. Reverse the transforms to reproduce realistic data.🧠 Multiple machine learning models -- ranging from Copulas to Deep Learning -- to create tabular,
multi table and time series data.📊 Measuring quality and privacy of synthetic data, and comparing different synthetic data
generation models.Get started using the SDV package-- a fully
integrated solution and your one-stop shop for synthetic data. Or, use the standalone libraries
for specific needs.Historyv0.10.0 - 2023-11-13This release updates all visualizations to use plotly, and removes the matplotlib dependency.New FeaturesMove visualization functions to plotly and get rid of matplotlib dependency - Issue#348by @fealhov0.9.2 - 2023-10-12This release removes a warning that was being raised when univariate distributions failed to fit and logs the message instead.New FeaturesWhen Copulas univariate fit fails, produce a log instead of a warning - Issue#359by @R-PalazzoMaintenanceSwitch default branch from master to main - Issue#360by @amontanez24Update add-on detection for Copulas - Issue#362by @pvk-developerv0.9.1 - 2023-08-10This release fixes problems with the documentation site and drops support for Python 3.7.MaintenanceDrop support for Python 3.7 - Issue#355by @amontanez24DocumentationFormatting is broken on the main docs page - Issue#341by @amontanez24v0.9.0 - 2023-04-26This release adds support for pandas 2.0 and above. Additionally adds a functionality to find
version add-ons and renamescovariancetocorrelation.MaintenanceRemove upper bound for pandas - Issue#349by @pvk-developerRename covariance to correlation - PR#346by @frances-hAdd functionality to find version add-on - Issue#349by @frances-hv0.8.0 - 2023-01-06This release adds support for python 3.10 and 3.11. Additionally, it drops support for python 3.6.MaintenanceSupport python 3.10 and above - PR#338by @pvk-developerCopulas Package Maintenance Updates - Issue#336by @pvk-developerAdd support for python 3.10 - PR#329by @katxiaov0.7.0 - 2022-05-10This release addsgaussianas a fallback distribution in case the user specified one fails. It also improves thefitof thebetadistribution by properly estimating thelocandscaleparameters.General ImprovementsAdd gaussian as fallback - Issue#320by @fealhoImprove the fit of the Beta distribution: Use the new loc and scale - Issue#317by @pvk-developerv0.6.1 - 2022-02-25This release improves therandom_statefunctionality by taking in RandomState objects in addition to
random seeds.General ImprovementsUse random_state instead of random_seed - Issue#113by @katxiaov0.6.0 - 2021-05-13This release makes Copulas compatible with Python 3.9! It also improves library maintenance by
updating dependencies, reorganizing the CI workflows, adding pip check to the workflows and
removing unused files.General ImprovementsAdd support for Python 3.9 - Issue#282by @amontanez24Remove entry point in setup.py - Issue#280by @amontanez24Update pandas dependency range - Issue#266by @katxiaoFix repository language - Issue#272by @pvk-developerAdd pip check to CI workflows - Issue#274by @pvk-developerReorganize workflows and add codecov - PR#267by @csalaConstrain jinja2 versions - PR#269by @fealhov0.5.1 - 2021-08-13This release improves performance by changing the way scipy stats is used,
calling their methods directly without creating intermediate instances.It also fixes a bug introduced by the scipy 1.7.0 release where some
distributions fail to fit because scipy validates the learned parameters.Issues ClosedException: Optimization converged to parameters that are outside the range allowed by the distribution. - Issue#264by @csalaUse scipy stats models directly without creating instances - Issue#261by @csalav0.5.0 - 2021-01-24This release introduces conditional sampling for the GaussianMultivariate modeling.
The new conditioning feature allows passing a dictionary with the values to use to condition
the rest of the columns.It also fixes a bug that prevented constant distributions to be restored from a dictionary
and updates some dependencies.New FeaturesConditional sampling from Gaussian copula - Issue#154by @csalaBug FixesScipyModel subclasses fail to restore constant values when usingfrom_dict- Issue#212by @csalav0.4.0 - 2021-01-27This release introduces a few changes to optimize processing speed by re-implementing
the Gaussian KDE pdf to use vectorized root finding methods and also adding the option
to subsample the data during univariate selection.General ImprovementsMakegaussian_kdefaster - Issue#200by @k15z and @fealhoUse sub-sampling inselect_univariate- Issue#183by @csalav0.3.3 - 2020-09-18General ImprovementsUsecorrinstead ofcovin the GaussianMultivariate - Issue#195by @rollervanAdd arguments to GaussianKDE - Issue#181by @rollervanNew FeaturesLog Laplace Distribution - Issue#188by @rollervanv0.3.2 - 2020-08-08General ImprovementsSupport Python 3.8 - Issue#185by @csalaSupport scipy >1.3 - Issue#180by @csalaNew FeaturesAdd Uniform Univariate - Issue#179by @rollervanv0.3.1 - 2020-07-09General ImprovementsRaise numpy version upper bound to 2 - Issue#178by @csalaNew FeaturesAdd Student T Univariate - Issue#172by @gbonomibBug FixesError in Quickstarts : Unknown projection '3d' - Issue#174by @csalav0.3.0 - 2020-03-27Important revamp of the internal implementation of the project, the testing
infrastructure and the documentation by Kevin Alex Zhang @k15z, Carles Sala
@csala and Kalyan Veeramachaneni @kveeramaEnhancementsReimplementation of the existing Univariate distributions.Addition of new Beta and Gamma Univariates.New Univariate API with automatic selection of the optimal distribution.Several improvements and fixes on the Bivariate and Multivariate Copulas implementation.New visualization module with simple plotting patterns to visualize probability distributions.New datasets module with toy datasets sampling functions.New testing infrastructure with end-to-end, numerical and large scale testing.Improved tutorials and documentation.v0.2.5 - 2020-01-17General ImprovementsConvert import_object to get_instance - Issue#114by @JDTheRipperPCv0.2.4 - 2019-12-23New FeaturesAllow creating copula classes directly - Issue#117by @csalaGeneral ImprovementsRemoveselect_copulafromBivariate- Issue#118by @csalaRename TruncNorm to TruncGaussian and make it non standard - Issue#102by @csala @JDTheRipperPCBugs fixedError on Frank and Gumble sampling - Issue#112by @csalav0.2.3 - 2019-09-17New FeaturesAdd support to Python 3.7 - Issue#53by @JDTheRipperPCGeneral ImprovementsDocument RELEASE workflow - Issue#105by @JDTheRipperPCImprove serialization of univariate distributions - Issue#99by @ManuelAlvarezC and @JDTheRipperPCBugs fixedThe method 'select_copula' of Bivariate return wrong CopulaType - Issue#101by @JDTheRipperPCv0.2.2 - 2019-07-31New Featurestruncnormdistribution and a generic wrapper forscipy.rv_continousdistributions - Issue#27by @amontanez, @csala and @ManuelAlvarezCIndependencebivariate copulas - Issue#46by @aliciasun, @csala and @ManuelAlvarezCOption to select seed on random number generator - Issue#63by @echo66 and @ManuelAlvarezCOption on Vine copulas to select number of rows to sample - Issue#77by @ManuelAlvarezCMake copulas accept both scalars and arrays as arguments - Issues#85and#90by @ManuelAlvarezCGeneral ImprovementsAbility to properly handle constant data - Issues#57and#82by @csala and @ManuelAlvarezCTests for analytics properties of copulas - Issue#61by @ManuelAlvarezCImproved documentation - Issue#96by @ManuelAlvarezCBugs fixedFix bug on Vine copulas, that made it crash during the bivariate copula selection - Issue#64by @echo66 and @ManuelAlvarezCv0.2.1 - Vine serializationAdd serialization to Vine copulas.Adddistributionas argument for the Gaussian Copula.Improve Bivariate Copulas code structure to remove code duplication.Fix bug in Vine Copulas sampling: 'Edge' object has no attribute 'index'Improve code documentation.Improve code style and linting tools configuration.v0.2.0 - Unified APINew API for stats methods.Standarize input and output tonumpy.ndarray.Increase unittest coverage to 90%.Add methods to load/save copulas.Improve Gaussian copula sampling accuracy.v0.1.1 - Minor ImprovementsDifferent Copula types separated in subclassesExtensive Unit TestingMore pythonic names in the public API.Stop using third party elements that will be deprected soon.Add methods to sample new data on bivariate copulas.New KDE Univariate copulaImproved examples with additional demo data.v0.1.0 - First ReleaseFirst release on PyPI.