[Mboost-commits] r757 - in pkg/mboostDevel: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Nov 15 20:24:21 CET 2013


Author: thothorn
Date: 2013-11-15 20:24:20 +0100 (Fri, 15 Nov 2013)
New Revision: 757

Modified:
   pkg/mboostDevel/R/control.R
   pkg/mboostDevel/R/mboost.R
   pkg/mboostDevel/man/control.Rd
Log:
internal stopping for oobag

Modified: pkg/mboostDevel/R/control.R
===================================================================
--- pkg/mboostDevel/R/control.R	2013-11-08 15:16:37 UTC (rev 756)
+++ pkg/mboostDevel/R/control.R	2013-11-15 19:24:20 UTC (rev 757)
@@ -1,12 +1,14 @@
 
 boost_control <- function(mstop = 100, nu = 0.1,
                           risk = c("inbag", "oobag", "none"),
+                          stopintern = FALSE,
                           center = TRUE, trace = FALSE) {
 
    risk <- match.arg(risk)
+   stopintern <- stopintern & (risk == "oobag")
    RET <- list(mstop = mstop, nu = nu,
-               risk = risk, center = center,
-               trace = trace)
+               risk = risk, stopintern = stopintern,
+               center = center, trace = trace)
    class(RET) <- c("boost_control")
    RET
 }

Modified: pkg/mboostDevel/R/mboost.R
===================================================================
--- pkg/mboostDevel/R/mboost.R	2013-11-08 15:16:37 UTC (rev 756)
+++ pkg/mboostDevel/R/mboost.R	2013-11-15 19:24:20 UTC (rev 757)
@@ -8,6 +8,13 @@
     risk <- control$risk
     nu <- control$nu
     trace <- control$trace
+    stopintern <- control$trace
+    if (is.numeric(stopintern)) {
+        stopeps <- stopintern
+        stopintern <- TRUE
+    } else {
+        stopeps <- 0
+    }
     tracestep <- options("width")$width / 2
 
     ### extract negative gradient and risk functions
@@ -134,6 +141,11 @@
             if (trace)
                 do_trace(m, mstop = mstop, risk = mrisk,
                          step = tracestep, width = niter)
+
+            ### internal stopping (for oobag risk only)
+            if (stopintern & (m > 1)) {
+                if ((mrisk[m] - mrisk[m - 1]) > stopeps) break
+            }
         }
         mstop <<- mstop + niter
         return(TRUE)

Modified: pkg/mboostDevel/man/control.Rd
===================================================================
--- pkg/mboostDevel/man/control.Rd	2013-11-08 15:16:37 UTC (rev 756)
+++ pkg/mboostDevel/man/control.Rd	2013-11-15 19:24:20 UTC (rev 757)
@@ -7,7 +7,7 @@
 }
 \usage{
 boost_control(mstop = 100, nu = 0.1,
-              risk = c("inbag", "oobag", "none"),
+              risk = c("inbag", "oobag", "none"), stopintern = FALSE,
               center = TRUE, trace = FALSE)
 }
 \arguments{
@@ -20,6 +20,10 @@
                risks computed for the learning sample (i.e., all non-zero weights),
                \code{oobag} to risks based on the out-of-bag (all observations with
                zero weights) and \code{none} to no risk computations at all.}
+  \item{stopintern}{ a logical that defines if the boosting algorithm stops internally
+                     when the out-of-bag risk in one iteration is larger than the 
+                     out-of-bag risk in the iteration before. Can also be a positive
+                     number giving the risk difference that needs to be exceeded.}
   \item{center}{ deprecated. A logical indicating if the numerical covariates should be mean
                  centered before fitting. Only implemented for
 		 \code{\link{glmboost}}. In \code{\link{blackboost}}



More information about the Mboost-commits mailing list