arahuja / hamiltonian-monte-carlo Goto Github PK
View Code? Open in Web Editor NEWImplementation of Hamiltonian Monte Carlo using Google's TensorFlow
License: Apache License 2.0
Implementation of Hamiltonian Monte Carlo using Google's TensorFlow
License: Apache License 2.0
Hi,
It seems that you might have written this over a year ago, so sorry to bother you...I'm running with TF 0.12.1, which is released a year ago (hopefully the same version that you used). And i got this error when running the example program:
Traceback (most recent call last):
File "gaussian_sampler_example.py", line 74, in <module>
num_steps=10)
File "/../hamiltonian_monte_carlo.py", line 98, in hmc
p_accept = min(1.0, tf.exp(orig - current))
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 547, in __nonzero__
raise TypeError("Using a `tf.Tensor` as a Python `bool` is not allowed. "
TypeError: Using a `tf.Tensor` as a Python `bool` is not allowed. Use `if t is not None:` instead of `if t:` to test if a tensor is defined, and use TensorFlow ops such as tf.cond to execute subgraphs conditioned on the value of a tensor.
Basically this line is problematic:
p_accept = min(1.0, tf.exp(orig - current))
I'm wondering if you are able to run the sample program and if there's a easy fix to this...
I think the signs of energy_function
and log_posterior
should be flipped to make everything consistent
In the example file it is starting a new chain each time, rather than refeeding the previous value into hmc
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.