GithubHelp home page GithubHelp logo

larsgeb / hmc-linear-systems Goto Github PK

View Code? Open in Web Editor NEW
3.0 5.0 0.0 1.43 MB

Hamiltonian Monte Carlo implemented for simple linear systems

Home Page: https://larsgeb.github.io/

License: BSD 3-Clause "New" or "Revised" License

CMake 2.56% C++ 80.75% Python 11.24% Shell 2.03% R 3.42%
markov-chain-monte-carlo hamiltonian-monte-carlo optimization bayesian-inference armadillo-library

hmc-linear-systems's People

Contributors

larsgeb avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

hmc-linear-systems's Issues

Create documentation

I would be nice to create documentation on every method and field, as well as a theoretical introduction to HMC. The goal is to use Doxygen, and this will probably be done very incremental.

Explicit symmetric

The code is much faster if positive definiteness is guaranteed for matrix A. It would be helpful if the settings accept a command line option for PD as to perform numerical optimization.

Incorrect implementation of HMC sampling criterion.

x_new = _acceptanceFactor * (_hmc ? energy() : chi());
double result;
result = (x - x_new)/_temperature;
double result_exponent;
result_exponent = exp(result);
if ((x_new < x) || (result_exponent > randf(0.0, 1.0) ) ) {
if (_testBefore) {
leap_frog(uturns, it == _proposals - 1);
}
accepted++;
x = x_new;
_currentModel = _proposedModel;
write_sample(samplesfile, x);
}
}

x_new = _acceptanceFactor * (_hmc ? energy() : chi());
double result;
result = (x - x_new)/_temperature;
double result_exponent;
result_exponent = exp(result);
if ((x_new < x) || (result_exponent > randf(0.0, 1.0) ) ) {
if (_testBefore) {
leap_frog(uturns, it == _proposals - 1);
}
accepted++;
x = x_new;
_currentModel = _proposedModel;
write_sample(samplesfile, x);
}
}
// Write results

Energy levels should be evaluated before and after the propagation. In this implementation the energy level is first evaluated before the resampling, which is not valid for the hmc sampler.

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.