Skip to content

Commit efcb425

Browse files
committed
Add test
1 parent 1065382 commit efcb425

File tree

4 files changed

+552
-0
lines changed

4 files changed

+552
-0
lines changed

src/test/interface/diagnose_test.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,21 @@ TEST(CommandDiagnose, mix) {
9696
ss << expected_output.rdbuf();
9797
EXPECT_EQ(1, count_matches(ss.str(), out.output));
9898
}
99+
100+
101+
TEST(CommandDiagnose, divergences) {
102+
std::string path_separator;
103+
path_separator.push_back(get_path_separator());
104+
std::string command = "bin" + path_separator + "diagnose";
105+
std::string csv_file = "src" + path_separator + "test" + path_separator
106+
+ "interface" + path_separator + "example_output"
107+
+ path_separator + "div_output*.csv";
108+
109+
run_command_output out = run_command(command + " " + csv_file);
110+
ASSERT_FALSE(out.hasError) << "\"" << out.command << "\" quit with an error";
111+
112+
std::ifstream expected_output("src/test/interface/example_output/div.nom");
113+
std::stringstream ss;
114+
ss << expected_output.rdbuf();
115+
EXPECT_EQ(1, count_matches(ss.str(), out.output));
116+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Checking sampler transitions treedepth.
2+
Treedepth satisfactory for all transitions.
3+
4+
Checking sampler transitions for divergences.
5+
77 of 400 (19.25%) transitions ended with a divergence.
6+
These divergent transitions indicate that HMC is not fully able to explore the posterior distribution.
7+
Try increasing adapt delta closer to 1.
8+
If this doesn't remove all divergences, try to reparameterize the model.
9+
10+
Checking E-BFMI - sampler transitions HMC potential energy.
11+
E-BFMI satisfactory.
12+
13+
Rank-normalized split effective sample size satisfactory for all parameters.
14+
15+
The following parameters had rank-normalized split R-hat greater than 1.01:
16+
x[1], x[2], x[3], x[4], x[5]
17+
Such high values indicate incomplete mixing and biased estimation.
18+
You should consider regularizating your model with additional prior information or a more effective parameterization.
19+
20+
Processing complete.

0 commit comments

Comments
 (0)