Giter VIP home page Giter VIP logo

svgd's Introduction

TensorFlow Implementation of Stein Variational Gradient Descent (SVGD)

References

Usages

  1. Define network, and get gradients and variables, e.g.,
def network():
    '''
    Define target density and return gradients and variables. 
    '''
    return gradients, variables
  1. Define gradient descent optimizer, e.g.,
def make_gradient_optimizer():
    return tf.train.GradientDescentOptimizer(learning_rate=0.01)
  1. Build multiple networks (particles) using network() and take all those gradients and variables in grads_list and vars_list.

  2. Make SVGD optimizer, e.g.,

optimizer = SVGD(grads_list, vars_list, make_gradient_optimizer)
  1. In the training phase, optimizer.update_op will do single SVGD update, e.g.,
sess = tf.Session()
sess.run(optimizer.update_op, feed_dict={X: x, Y: y})

Examples

1D Gaussian mixture

  • The goal of this problem is to match the target density p(x) (mixture of two Gaussians) by moving the particles initially sampled from other distributions q(x). For details, I recommend you to see the experiment section in the authors' paper.

  • I got the following result:

  • NOTE THAT I compared my implementation with that of authors and checked the results are the same.

Bayesian Binary Classification

  • In this example, we want to classify binary data by using multiple neural classifier. I checked how SVGD differs from ensemble method in this example. I made a pdf file for detailed mathematical derivations.

  • I got the following results:

    • Thus, ensemble methods make particles to strongly classify samples, where as SVGD leads to draw the particles that characterize the posterior distribution.

svgd's People

Contributors

wsjeon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mingukkang

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.