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

Remove duplicate acceptance procedure, update tests #1979

Merged
merged 2 commits into from Jul 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/stan/mcmc/hmc/nuts/base_nuts.hpp
Expand Up @@ -106,11 +106,6 @@ namespace stan {
// Sample from an accepted subtree
++(this->depth_);

double accept_prob
= std::exp(log_sum_weight_subtree - log_sum_weight);
if (this->rand_uniform_() < accept_prob)
z_sample = z_propose;

if (log_sum_weight_subtree > log_sum_weight) {
z_sample = z_propose;
} else {
Expand Down
12 changes: 6 additions & 6 deletions src/test/performance/logistic_test.cpp
Expand Up @@ -108,13 +108,13 @@ TEST_F(performance, values_from_tagged_version) {
<< "last tagged version, 2.9.0, had " << N_values << " elements";

std::vector<double> first_run = last_draws_per_run[0];
EXPECT_FLOAT_EQ(-67.4618, first_run[0])
EXPECT_FLOAT_EQ(-65.742996, first_run[0])
<< "lp__: index 0";

EXPECT_FLOAT_EQ(0.96871901, first_run[1])
EXPECT_FLOAT_EQ(0.622922, first_run[1])
<< "accept_stat__: index 1";

EXPECT_FLOAT_EQ(1.21214, first_run[2])
EXPECT_FLOAT_EQ(1.15558, first_run[2])
<< "stepsize__: index 2";

EXPECT_FLOAT_EQ(1, first_run[3])
Expand All @@ -126,13 +126,13 @@ TEST_F(performance, values_from_tagged_version) {
EXPECT_FLOAT_EQ(0, first_run[5])
<< "divergent__: index 5";

EXPECT_FLOAT_EQ(68.961502, first_run[6])
EXPECT_FLOAT_EQ(67.453796, first_run[6])
<< "energy__: index 6";

EXPECT_FLOAT_EQ(1.79573, first_run[7])
EXPECT_FLOAT_EQ(1.40756, first_run[7])
<< "beta.1: index 7";

EXPECT_FLOAT_EQ(-0.77275401, first_run[8])
EXPECT_FLOAT_EQ(-0.763035, first_run[8])
<< "beta.2: index 8";

matches_tagged_version = !HasNonfatalFailure();
Expand Down
2 changes: 1 addition & 1 deletion src/test/unit/mcmc/hmc/nuts/base_nuts_test.cpp
Expand Up @@ -272,7 +272,7 @@ TEST(McmcNutsBaseNuts, transition) {

stan::mcmc::sample s = sampler.transition(init_sample, writer, error_writer);

EXPECT_EQ(-42, s.cont_params()(0));
EXPECT_EQ(31.5, s.cont_params()(0));
EXPECT_EQ(0, s.log_prob());
EXPECT_EQ(1, s.accept_stat());
EXPECT_EQ("", output_stream.str());
Expand Down
10 changes: 5 additions & 5 deletions src/test/unit/mcmc/hmc/nuts/softabs_nuts_test.cpp
Expand Up @@ -109,11 +109,11 @@ TEST(McmcSoftAbsNuts, transition) {

stan::mcmc::sample s = sampler.transition(init_sample, writer, error_writer);

EXPECT_FLOAT_EQ(-0.13615179, s.cont_params()(0));
EXPECT_FLOAT_EQ(-0.53625083, s.cont_params()(1));
EXPECT_FLOAT_EQ(0.073073119, s.cont_params()(2));
EXPECT_FLOAT_EQ(-0.15572098, s.log_prob());
EXPECT_FLOAT_EQ(0.99829924, s.accept_stat());
EXPECT_FLOAT_EQ(1.9313564, s.cont_params()(0));
EXPECT_FLOAT_EQ(-0.86902142, s.cont_params()(1));
EXPECT_FLOAT_EQ(1.6008, s.cont_params()(2));
EXPECT_FLOAT_EQ(-3.5239484, s.log_prob());
EXPECT_FLOAT_EQ(0.99709648, s.accept_stat());
EXPECT_EQ("", output.str());
EXPECT_EQ("", error_stream.str());
}
10 changes: 5 additions & 5 deletions src/test/unit/mcmc/hmc/nuts/unit_e_nuts_test.cpp
Expand Up @@ -109,11 +109,11 @@ TEST(McmcUnitENuts, transition) {

stan::mcmc::sample s = sampler.transition(init_sample, writer, error_writer);

EXPECT_FLOAT_EQ(-0.30853021, s.cont_params()(0));
EXPECT_FLOAT_EQ(-0.44694126, s.cont_params()(1));
EXPECT_FLOAT_EQ(-0.073457584, s.cont_params()(2));
EXPECT_FLOAT_EQ(-0.1501717, s.log_prob());
EXPECT_FLOAT_EQ(0.99752671, s.accept_stat());
EXPECT_FLOAT_EQ(1.6761723, s.cont_params()(0));
EXPECT_FLOAT_EQ(-1.1139321, s.cont_params()(1));
EXPECT_FLOAT_EQ(1.5012255, s.cont_params()(2));
EXPECT_FLOAT_EQ(-3.1520379, s.log_prob());
EXPECT_FLOAT_EQ(0.99629009, s.accept_stat());
EXPECT_EQ("", output_stream.str());
EXPECT_EQ("", error_stream.str());
}