Matlab code to reproduce figures from the paper (run with Matlab 2024 for the experiments shown in the paper).

"A Spectral Framework for Closed-Form Relative Density Estimation",

by Francis Bach.

The script "launch_all_simulations.m" launches the reproduction of all figures (as detailed below the license file, with their running times).

The code is written by the authors in the vast majority, except for a few helper functions generated by ChatGPT-pro that are all in the folder "gpt", and some local rewrites for improved speed. A few publicly available third-party toolbox codes were used (named with their source, in the folder "misc").

This package is provided free for non-commercial use under the terms of the GNU General Public License. If you have any questions or comments regarding this package, or if you want to report any bugs, please send an email to francis.bach@inria.fr. 


% Figure 4  < 1 min
plot_examples_closedform;

% Figure 5  < 1 min
plot_examples_closedform_MI;

% Figure 1 (left, center)  < 3 min
plot_scaling_laws;

% Figure 1 (right)  < 18 min
estimator_comparison_val;

% Figure 3 (left)  < 2 min
latent_dimensions

% Figure 2 (left) < 20 min
comparison_softmax_optim;

% Figure 2 (middle) < 32 min
comparison_softmax_test_val;

% Figure 2 (right)  < 18 min
estimator_comparison_MI_val;

% Figure 3 (right)  < 131 min
estimator_comparison_nn_val;




