Skip to content

Commit

Permalink
added new early_stopping alias
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb committed Sep 25, 2019
1 parent acac79a commit b0dcce4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion R-package/R/lgb.cv.R
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ lgb.cv <- function(params = list(),

# If early stopping was passed as a parameter in params(), prefer that to keyword argument
# early_stopping_rounds by overwriting the value in 'early_stopping_rounds'
early_stop <- c("early_stopping_round", "early_stopping_rounds", "early_stopping")
early_stop <- c("early_stopping_round", "early_stopping_rounds", "early_stopping", "n_iter_no_change")
early_stop_param_indx <- names(params) %in% early_stop
if (any(early_stop_param_indx)) {
first_early_stop_param <- which(early_stop_param_indx)[[1]]
Expand Down
6 changes: 3 additions & 3 deletions R-package/R/lgb.train.R
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ lgb.train <- function(params = list(),

# If early stopping was passed as a parameter in params(), prefer that to keyword argument
# early_stopping_rounds by overwriting the value in 'early_stopping_rounds'
early_stop <- c("early_stopping_round", "early_stopping_rounds", "early_stopping")
early_stop <- c("early_stopping_round", "early_stopping_rounds", "early_stopping", "n_iter_no_change")
early_stop_param_indx <- names(params) %in% early_stop
if (any(early_stop_param_indx)) {
first_early_stop_param <- which(early_stop_param_indx)[[1]]
Expand All @@ -205,8 +205,8 @@ lgb.train <- function(params = list(),
}

using_early_stopping <- !is.null(early_stopping_rounds)
if (using_early_stopping && identical(params$boosting, "dart")){
warning("Early stopping is not available in 'dart' mode")
if (identical(params$boosting, "dart")){
warning("Early stopping is not available in 'dart' mode.")
use_early_stopping <- FALSE
}

Expand Down

0 comments on commit b0dcce4

Please sign in to comment.