Coder Social home page Coder Social logo

mp's Introduction

MP: Martingale Posteriors with Copulas

This repository contains the code for the illustrations in the preprint "Martingale Posterior Distributions" by Edwin Fong, Chris Holmes and Stephen G. Walker, which can be found here.

We provide the run scripts for obtaining the numerical results and plots in the paper, and the run scripts use our pr_copula package. The pr_copula package is a general-purpose Python package built on JAX for predictive bivariate copula updating with predictive resampling, returning density estimates and uncertainty. The package version here is a snapshot for the experiments in the paper - we will likely continue active development on the package in a separate repository. We may include a vignette on how to use the package at a later time.

Installation

The pr_copula package can be installed by runnning the following in the main folder:

python3 setup.py install

or the following if you'd like to make edits to the package:

python3 setup.py develop

We recommend doing so in a clean virtual environment if reproducing the experimental results is of interest.

Please check the JAX page for instructions on installing JAX for CPU versus GPU usage - both should work with pr_copula for general use. Note that for the numerical values and plots in the paper, the CPU version was used for reproducibility due to the non-determinism of GPU calculations, and timing was carried out on the GPU version. For full reproducibility of the experiments in the paper, please use the versions installed by setup.py, that is jax==0.2.6 and jaxlib==0.1.57.

The suggested version of R is โ‰ฅ4.0 for the MCMC examples. Please install the dirichletprocess package here.

Running Experiments

All experiment scripts can be found in run_expt. The scripts are prefixed based on the order in which the experiments appear in the paper, and running the Python scripts should involve entering the following in terminal when in the run_expt folder, for example:

python3 1_univariate_copula.py

The R scripts can be run in RStudio or terminal, and should be run after the corresponding Python scripts, as some datasets are simulated/downloaded into the R_data folder by the Python scripts.

Outputs from the experiments (e.g. martingale posterior samples) are stored in plot_files, and all plots in the paper can be produced using the Jupyter notebook Experiments_Plots.ipynb. Finally, Misc_Plots.ipynb produces the other 2 plots in the paper outside the experiments sections.

Data

For convenience, some UCI Machine Learning Repository datasets are included in run_expt/data. These are:

Other datasets are imported from the appropriate R/Python packages, or can also be found here:

mp's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.