This repository contains code from my paper 'Your copula is a classifier in disguise: classification-based copula density estimation' accepted at AISTATS 25.
Paper: https://arxiv.org/abs/2411.03014
-
Figure 1: Our model estimates copula densities through classification.
The code for this is in the Figure 1/figure1.ipynbnotebook, and can be run in less than a minute on a CPU. It can also serve as a good starting point to using Ratio copulas on your own! -
Figure 2: 2D copula models trained on monochromatic images.
Use the Figure 2/2d_single_image.ipynbnotebook. It will load the relevant samples and densities and plot the figure. The notebook also includes the code for the IGC and TLL/vine copulas. For the Ratio Copula, training is done withFigure 2/2d_image_cop_simpleNNET.pyandFigure 2/2d_image_einstein_simpleNNET.py.pyfor each of the pictures. -
Figure 3: Box plots showing the average LL across 25 fits on samples from different parametric copulas.
The files for this figure are contained in 2D copulas. The2d_experiments_plot.ipynbnotebook can be run to produce the figure; it will load all experiment data and reproduce the exact same figure as in the paper. Python scripts (2dexperiments_L_ratio.pyand2dexperiments_NNet_ratio.py) can be run for the ratio copula models while the parametric copula benchmarks are run from the2d_experiments_plot.ipynbnotebook directly (you will need to uncomment those parts). -
Figure 4: Example equivalent classifiers for six parametric copulas.
There is a notebook in Figure 4/Figure 4.ipynbwith all the code to produce this figure. -
Figure 5: Using other losses for better tail modelling.
There is a single notebook Figure 5/Rebuttal_exp copy.ipynbwith all the code needed to reproduce the figure. -
Figure 6: Digits samples from copula models.
The notebook Figure 6/digits_exp.ipynbhas the code to load samples and produce the plot. The samples can also be found in the folder. -
Figure 7: MNIST samples from copula models.
The notebook Figure 7/Figure 7.ipynbhas the code to load samples and produce the plot. The samples can also be found in the folder. -
Table 1: Log-likelihoods and Wasserstein-2 on high-dimensional datasets. There are two folders inside:
Table 1/MNIST_expandTable 1/Digits_exp. Each contains python files for training and sampling from the copula models.