Skip to content

Commit

Permalink
[R-package] add reset parameters for CV object
Browse files Browse the repository at this point in the history
  • Loading branch information
guolinke committed Jan 8, 2017
1 parent 88e6beb commit f3f2f5a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions R-package/R/lgb.cv.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ CVBooster <- R6Class(
boosters=list(),
initialize=function(x){
self$boosters <- x
},
reset_parameter=function(new_paramas){
for(x in boosters){
x$reset_parameter(new_paramas)
}
return(self)
}
)
)
Expand Down Expand Up @@ -270,7 +276,13 @@ lgb.stratified.folds <- function(y, k = 10)
}

lgb.merge.cv.result <- function(msg, showsd=TRUE){
if(length(msg) == 0){
stop("lgb.cv: size of cv result error")
}
eval_len <- length(msg[[1]])
if(eval_len == 0){
stop("lgb.cv: should provide at least metric for CV")
}
eval_result <- lapply(1:eval_len, function(j) {
as.numeric(lapply(1:length(msg), function(i){
msg[[i]][[j]]$value
Expand Down

0 comments on commit f3f2f5a

Please sign in to comment.