Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix for #412 #413

Merged
merged 4 commits into from
Jan 21, 2017
Merged

Bug fix for #412 #413

merged 4 commits into from
Jan 21, 2017

Conversation

dustinvtran
Copy link
Member

@dustinvtran dustinvtran commented Jan 18, 2017

Consider the unit test in this pull request. It performs HMC or SGLD on Bayesian NN classification. It does not run (see #412); with this PR, it does.

In HMC, we assume the order of the dictionaries z_old and z_new align. They do not: to see this, run the test while adding the following above line 167 of hmc.py:

print(list(six.iterkeys(z_old)))
print(list(six.iterkeys(z_new)))

This alignment is necessary because in line 102, sample always uses the key order in new_sample. I resolved this by enforcing OrderedDicts.

In SGLD, we assume the order of the dictionaries old_sample and self.latent_vars align. They do not: to see this, run the test while adding the following below line 61 of sgld.py:

print(list(six.iterkeys(old_sample)))
print(list(six.iterkeys(self.latent_vars)))

This alignment is necessary because in the loop of line 70, we assume grad_log_joint (which
uses old_sample's order) has the same order as self.latent_vars. I resolved this by changing the looping variables.

todo's

  • make unit test actually a unit test
  • check if this is also a problem in other monte carlo methods

@dustinvtran dustinvtran merged commit b5a3849 into master Jan 21, 2017
@dustinvtran dustinvtran deleted the bugfix/issue-412 branch January 21, 2017 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant