R/mstop.R

Defines functions mstop mstop.cfboost mstop.cv

Documented in mstop mstop.cfboost mstop.cv

######################################################
## Function to Extract (Optimal) Stopping Iteration ##
######################################################

mstop <- function(object, ...)
    UseMethod("mstop")

mstop.cfboost <- function(object, opt = TRUE, ...){
    if(!opt){
        #warning("returned value is not the optimal mstop")
        return(NROW(object$ensemble))
    } else {
        mr <- print(risk(object), print = FALSE)
        if (class(mr) == "inbag")
            warning("computing ", sQuote("mstop"), " on learning sample may lead to overfitting")
        return(mr$iteration)
    }
}

mstop.cv <- function(object, ...)
    attr(object, "mstop")[which.min(colSums(object))]

Try the CoxFlexBoost package in your browser

Any scripts or data that you put into this service are public.

CoxFlexBoost documentation built on May 2, 2019, 6:53 p.m.