"src/git@developer.sourcefind.cn:tianlh/lightgbm-dcu.git" did not exist on "fe115bbb7215d3cf966ee406a017f208b5610900"
Commit f3f2f5a9 authored by Guolin Ke's avatar Guolin Ke
Browse files

[R-package] add reset parameters for CV object

parent 88e6beb8
...@@ -7,6 +7,12 @@ CVBooster <- R6Class( ...@@ -7,6 +7,12 @@ CVBooster <- R6Class(
boosters=list(), boosters=list(),
initialize=function(x){ initialize=function(x){
self$boosters <- x self$boosters <- x
},
reset_parameter=function(new_paramas){
for(x in boosters){
x$reset_parameter(new_paramas)
}
return(self)
} }
) )
) )
...@@ -270,7 +276,13 @@ lgb.stratified.folds <- function(y, k = 10) ...@@ -270,7 +276,13 @@ lgb.stratified.folds <- function(y, k = 10)
} }
lgb.merge.cv.result <- function(msg, showsd=TRUE){ 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]]) 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) { eval_result <- lapply(1:eval_len, function(j) {
as.numeric(lapply(1:length(msg), function(i){ as.numeric(lapply(1:length(msg), function(i){
msg[[i]][[j]]$value msg[[i]][[j]]$value
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment