Coder Social home page Coder Social logo

msabvid / mlmc-mimc-sgd Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 208 KB

Stochastic MCMC methods for Bayesian regression with variance reduction (MLMC with antithetic samples, MIMC with antithetic samples, control variate using MAP estimate) using Pytorch

License: GNU General Public License v3.0

Python 100.00%

mlmc-mimc-sgd's Introduction

MLMC-MIMC-SGD

WARNING work in progress

Code for the numerical experiments in the paper Multi-Index Antithetic Stochastic Gradient Algorithm

This repository contains Stochastic MCMC methods for Bayesian regression with variance reduction (MLMC with antithetic samples, MIMC with antithetic samples, control variate using MAP estimate) using Pytorch:

  • MASGA (Multi-index Antithetic Stochastic Gradient Algorithm). Multi-index and antithetic samples at the level of the time discretisation and subsampling on the Stochastic Langevin SDE. For mathematical details, see

      @misc{majka2020multiindex,
          title={Multi-index Antithetic Stochastic Gradient Algorithm},
          author={Mateusz B. Majka and Marc Sabate-Vidales and Łukasz Szpruch},
          year={2020},
          eprint={2006.06102},
          archivePrefix={arXiv},
          primaryClass={stat.ML}
      }
    
  • Stochastic Langevin Dynamics using Control Variate to reduce the variance a MAP estimator. This algorithm is taken from the paper Control Variates for Stochastic Gradient MCMC and is used for benchmarking purposes.

Acknowledgements

MLMC and MIMC abstract classes initially based on https://bitbucket.org/pefarrell/pymlmc/src/master/.

Files

Running the code

  • Bayesian logistic regression with Gaussian prior on covertype dataset (the code is already prepared to download it). The code samples from the posterior using antithetic MLMC on the discretised Stochastic Langeving SDE and approximates E(F(X)), with F(X) = |X|^2. The code returns various plots specifying computational costs necessary to achieve different Mean Squared Errors.
python logistic_masga_mlmc_subsampling.py --prior Gaussian --T 5 --n_steps 100 --device 1 --s0 32 --type_data covtype --Lmin 0 --N 10000
  • Bayesian logistic regression with Mixture of two Gaussians as the prior on a synthetic dataset:
python logistic_masga_mlmc_subsampling.py --prior MixtureGaussians --T 5 --n_steps 100 --device 1 --s0 2 --dim 2 --data_size 512 --type_data synthetic --Lmin 0 --N 10000

mlmc-mimc-sgd's People

Contributors

msabvid avatar

Stargazers

 avatar Imtiaz Ahmad Ali avatar

Watchers

James Cloos avatar  avatar paper2code - bot avatar

Forkers

patrickens

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.