Git Product home page Git Product logo

in-depth-vi-tutorial's Introduction

In-Depth Variational Inference Tutorial

Common Utils

In common_utils.py, there are some parameters you may want to set. It contains N, d, K (number of data points, dimension, number of clusters) and some hyperparameters. The code should be able to handle any value of d, but right now we are plotting stuff, and the code can only plot up to 2 dimensions. So if d > 2, you should turn off the plotting.

Data generation

After having set your parameters, you can generate data using python data_generator.py. You will get print outs of parameter values and plots of the data you just generated. It saves the data to a file called data.txt. If you look inside data_generator.py, you can always figure out how to plot data from data.txt if you generated it a while back and forgot what it looks like.

Running the algorithms

To run the VI/SVI algorithms, simply run:

  • $:~ python variational_inference.py
  • $:~ python stochastic_variational_inference.py.

You must make sure that data.txt is in the current directory. Look through the code for more details. We also include a comparison script to compare batch VI vs. minibatch SVI. You can run this by running:

  • $:~ python compare_VI_SVI.py

These files will give plots that were shown in the tutorial.

in-depth-vi-tutorial's People

Contributors

chrisdxie avatar

Watchers

 avatar  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.