Skip to content

Commit

Permalink
Add a quick warning when the model does not have enough trees
Browse files Browse the repository at this point in the history
  • Loading branch information
jiho committed Jan 13, 2014
1 parent 57f8a4e commit be9d62f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions library/lib_brt2.R
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ summary.brt <- function(m, n.trees=m$best.iter, ...) {
rel.inf <- round(100 * rel.inf/sum(rel.inf), 2)
rel.inf <- sort(rel.inf, decreasing=TRUE)


if (m$best.iter >= (0.9 * m$n.trees)) {
cat("WARNING !!! Not enough trees computed (using", m$best.iter ,"of", m$n.trees, "computed). You should increase the maximum number of trees (and possibly the shrinkage) and refit the model before proceeding to the analysis. WARNING !!!")
}
cat("A gradient boosted model with bernoulli loss function.\n")
cat(m$n.trees,"iterations were performed\n")
cat("The best cross-validated iteration was",m$best.iter,"\n")
Expand Down

0 comments on commit be9d62f

Please sign in to comment.