{"id":17815609,"url":"https://github.com/asnelt/mixedvines","last_synced_at":"2026-03-17T13:10:56.359Z","repository":{"id":57442034,"uuid":"79915624","full_name":"asnelt/mixedvines","owner":"asnelt","description":"Python package for canonical vine copula trees with mixed continuous and discrete marginals","archived":false,"fork":false,"pushed_at":"2023-12-21T00:54:26.000Z","size":342,"stargazers_count":47,"open_issues_count":0,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-16T15:17:26.931Z","etag":null,"topics":["c-vines","copula","copula-models","copulae","copulas","data-analysis","dependency-analysis","dependency-modeling","modeling","python","regular-vines","statistics"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asnelt.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-24T13:50:36.000Z","updated_at":"2024-09-07T11:38:36.000Z","dependencies_parsed_at":"2024-10-27T16:25:48.006Z","dependency_job_id":"c1b682bf-be9f-4943-9f71-a171f127f64e","html_url":"https://github.com/asnelt/mixedvines","commit_stats":{"total_commits":117,"total_committers":4,"mean_commits":29.25,"dds":"0.29059829059829057","last_synced_commit":"b27491c312699ff61478b7903305a8ed8734a3d0"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/asnelt/mixedvines","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asnelt%2Fmixedvines","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asnelt%2Fmixedvines/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asnelt%2Fmixedvines/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asnelt%2Fmixedvines/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asnelt","download_url":"https://codeload.github.com/asnelt/mixedvines/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asnelt%2Fmixedvines/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266691576,"owners_count":23969181,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-vines","copula","copula-models","copulae","copulas","data-analysis","dependency-analysis","dependency-modeling","modeling","python","regular-vines","statistics"],"created_at":"2024-10-27T16:13:49.126Z","updated_at":"2026-03-17T13:10:56.260Z","avatar_url":"https://github.com/asnelt.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"=============================\nmixedvines Package for Python\n=============================\n\nPackage for canonical vine copula trees with mixed continuous and discrete\nmarginals.  If you use this software for publication, please cite\n[ONKEN2016]_.\n\n\nDescription\n-----------\n\nThis package contains a complete framework based on canonical vine copulas for\nmodeling multivariate data that are partly discrete and partly continuous.\nThe resulting multivariate distributions are flexible with rich dependence\nstructures and marginals.\n\nFor continuous marginals, implementations of the normal and the gamma\ndistributions are provided.  For discrete marginals, Poisson, binomial and\nnegative binomial distributions are provided.  As bivariate copula building\nblocks, the Gaussian, Frank and Clayton families as well as rotation\ntransformed families are provided.  Additional marginal and pair-copula\ndistributions can be added easily.\n\nThe package includes methods for sampling, likelihood calculation and\ninference, all of which have quadratic complexity.  These procedures are\ncombined to estimate entropy by means of Monte Carlo integration.\n\nPlease see [ONKEN2016]_ for a more detailed description of the framework.\n\n\nDocumentation\n-------------\n\nThe full documentation for the mixedvines package is available at\n`Read the Docs\n\u003chttp://mixedvines.readthedocs.io/\u003e`_.\n\n\nRequirements\n------------\n\nThe package requires Python 3.10 or greater and additionally requires\n`NumPy and SciPy\n\u003chttp://www.scipy.org/install.html\u003e`_.\n\n\nInstallation\n------------\n\nTo install the mixedvines package, run::\n\n    pip install mixedvines\n\n\nUsage\n-----\n\nSuppose that data are given in a NumPy array ``samples`` with shape\n``(n, d)``, where ``n`` is the number of samples and ``d`` is the number of\nelements per sample.  First, specify which of the elements are continuous.\nIf, for instance, the distribution has three elements and the first and last\nelements are continuous whereas the second element is discrete:\n\n.. code-block:: python\n\n    is_continuous = [True, False, True]\n\nTo fit a mixed vine to the samples:\n\n.. code-block:: python\n\n    from mixedvines.mixedvine import MixedVine\n    vine = MixedVine.fit(samples, is_continuous)\n\n``vine`` is now a ``MixedVine`` object.  To draw samples from the\ndistribution, calculate their density and estimate the distribution entropy in\nunits of bits:\n\n.. code-block:: python\n\n    samples = vine.rvs(size=100)\n    logpdf = vine.logpdf(samples)\n    entropy, standard_error_mean = vine.entropy(sem_tol=1e-2)\n\nTo manually construct and visualize a simple mixed vine model:\n\n.. code-block:: python\n\n    from scipy.stats import norm, gamma, poisson\n    import numpy as np\n    from mixedvines.copula import GaussianCopula, ClaytonCopula, FrankCopula\n    from mixedvines.mixedvine import MixedVine\n    import matplotlib.pyplot as plt\n    import itertools\n    # Manually construct mixed vine\n    dim = 3  # Dimension\n    vine = MixedVine(dim)\n    # Specify marginals\n    vine.set_marginal(0, norm(0, 1))\n    vine.set_marginal(1, poisson(5))\n    vine.set_marginal(2, gamma(2, 0, 4))\n    # Specify pair-copulas\n    vine.set_copula(1, 0, GaussianCopula(0.5))\n    vine.set_copula(1, 1, FrankCopula(4))\n    vine.set_copula(2, 0, ClaytonCopula(5))\n    # Calculate probability density function on lattice\n    bnds = np.empty((3), dtype=object)\n    bnds[0] = [-3, 3]\n    bnds[1] = [0, 15]\n    bnds[2] = [0.5, 25]\n    x0, x1, x2 = np.mgrid[bnds[0][0]:bnds[0][1]:0.05, bnds[1][0]:bnds[1][1],\n                          bnds[2][0]:bnds[2][1]:0.1]\n    points = np.array([x0.ravel(), x1.ravel(), x2.ravel()]).T\n    pdf = vine.pdf(points)\n    pdf = np.reshape(pdf, x1.shape)\n    # Generate random variates\n    size = 100\n    samples = vine.rvs(size)\n    # Visualize 2d marginals and samples\n    comb = list(itertools.combinations(range(dim), 2))\n    for i, cmb in enumerate(comb):\n        # Sum over all axes not in cmb\n        cmb_inv = tuple(set(range(dim)) - set(cmb))\n        margin = np.sum(pdf, axis=cmb_inv).T\n        plt.subplot(2, len(comb), i + 1)\n        plt.imshow(margin, aspect='auto', interpolation='none', cmap='hot',\n                   origin='lower', extent=[bnds[cmb[0]][0], bnds[cmb[0]][1],\n                                           bnds[cmb[1]][0], bnds[cmb[1]][1]])\n        plt.ylabel('$x_' + str(cmb[1]) + '$')\n        plt.subplot(2, len(comb), len(comb) + i + 1)\n        plt.scatter(samples[:, cmb[0]], samples[:, cmb[1]], s=1)\n        plt.xlim(bnds[cmb[0]][0], bnds[cmb[0]][1])\n        plt.ylim(bnds[cmb[1]][0], bnds[cmb[1]][1])\n        plt.xlabel('$x_' + str(cmb[0]) + '$')\n        plt.ylabel('$x_' + str(cmb[1]) + '$')\n    plt.tight_layout()\n    plt.show()\n\nThis code shows the 2d marginals and 100 samples of a 3d mixed vine.\n\n\nSource code\n-----------\n\nThe source code of the mixedvines package is hosted on\n`GitHub\n\u003chttps://github.com/asnelt/mixedvines/\u003e`_.\n\n\nReferences\n----------\n\n.. [ONKEN2016] A. Onken and S. Panzeri (2016).  Mixed vine copulas as joint\n   models of spike counts and local field potentials.  In D. D. Lee,\n   M. Sugiyama, U. V. Luxburg, I. Guyon and R. Garnett, editors, Advances in\n   Neural Information Processing Systems 29 (NIPS 2016), pages 1325-1333.\n\n\nLicense\n-------\n\nCopyright (C) 2017-2019, 2021-2023 Arno Onken\n\nThis file is part of the mixedvines package.\n\nThe mixedvines package is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by the Free\nSoftware Foundation, version 3.\n\nThe mixedvines package is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more\ndetails.\n\nYou should have received a copy of the GNU General Public License along with\nthis program; if not, see \u003chttp://www.gnu.org/licenses/\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasnelt%2Fmixedvines","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasnelt%2Fmixedvines","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasnelt%2Fmixedvines/lists"}