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

identify possibly latent, long-standing bug ... or I am a fool #1191

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/dr/inference/markovchain/MarkovChain.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,29 @@ public long runChain(long length, boolean disableCoerce) {
// The new model is evaluated
score = evaluate(likelihood);

boolean EXTRA_CHECK = true;

if (EXTRA_CHECK) {
String before = likelihood instanceof CompoundLikelihood ?
((CompoundLikelihood) likelihood).getDiagnosis() : "";

likelihood.makeDirty();
double newScore = evaluate(likelihood);

String after = likelihood instanceof CompoundLikelihood ?
((CompoundLikelihood) likelihood).getDiagnosis() : "";

if (Math.abs(score - newScore) > evaluationTestThreshold) {

System.err.println("Latent error:");
System.err.println(before);
System.err.println();
System.err.println(after);

System.exit(-1);
}
}

if (PROFILE) {
long duration = System.currentTimeMillis() - elapsedTime;
if (DEBUG) {
Expand Down