Code Monkey home page Code Monkey logo

stein-control-variates-with-sgd's Introduction

Stein Control Variates with SGD

This repository presents python3 code for the paper entitled ``Scalable Control Variates for Monte Carlo Methods via Stochastic Optimization" by Shijing Si, Chris Oates, Andrew B. Duncan, Lawrence Carin, and François-Xavier Briol (https://arxiv.org/abs/2006.07487). Specifically, we provide the code for polynomial, kernel and neural networks control variates.

requirements:

python3.5+

scipy==1.5.2

numpy==1.19.2

torch==1.6.0

sklearn==0.23.2

Toy examples

In order to make it easy for people to use it, we provide an example in the demonstration--polynomial_integrand_experiments.ipynb file, where the integrand is polynomials of the form $\Sum_{i=1}^{m}\Sum_{j=1}^{n}A_{i,j}x_{i}^{j}$; and the probability measure is normal distribution with zero mean and standard deviation $\sigma$.

How to train Control Variates with SGD algorithm

For all these control variates, you need to instantiate the class first, SteinSecondOrderQuadPolyCV (Second order polynomial Control Variates), SteinFirstOrderQuadPolyCV (First order controil variates), SteinFirstOrderNeuralNets (Neural Networks), and GaussianControlVariate (Kernel Control Variates). For the kernel control variates, we need to import OatesGram to evaluate the Gram matrix of the kernel. Then you need to feed the samples ($X$), and evaluations $f(X)$, and score function evaluations at $X$ to the train() method of these classes to train the control variates.

The performance may vary significantly with different configuration of hyper-parameters. So please tune the hyper-parameters to get good results.

stein-control-variates-with-sgd's People

Contributors

shijing001 avatar

Stargazers

 avatar Harrison Zhu avatar

Watchers

 avatar

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.