Skip to content

Commit

Permalink
print info on failed updates (if any)
Browse files Browse the repository at this point in the history
  • Loading branch information
jarioksa committed Dec 14, 2021
1 parent 9aed197 commit 011193e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions R/print.Hmsc.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,16 @@ print.Hmsc = function(x, ...)
cat(nchain, "chains each with ")
cat(x$samples, "samples, thin", x$thin, "and transient", x$transient,
"\n")
## info on failed updaters (if any)
fails <- sapply(x$postList, attr, which = "failedUpdates")
if (is.matrix(fails) && any(fails > 0)) {
fails <- t(fails)
rownames(fails) <- paste0("Chain ",
as.character(seq_len(nrow(fails))), ":")
fails <- fails[rowSums(fails) > 0, colSums(fails) > 0, drop = FALSE]
cat("Updater failures in following chains with ",
x$samples * x$thin + x$transient, " attemps in each chain:\n")
print(fails)
}
}
}

0 comments on commit 011193e

Please sign in to comment.