Unverified Commit c45a82f0 authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[R-package] remove uses of ... in Predictor constructor (#4338)

parent 2b485ce5
...@@ -501,7 +501,8 @@ Booster <- R6::R6Class( ...@@ -501,7 +501,8 @@ Booster <- R6::R6Class(
predleaf = FALSE, predleaf = FALSE,
predcontrib = FALSE, predcontrib = FALSE,
header = FALSE, header = FALSE,
reshape = FALSE, ...) { reshape = FALSE,
...) {
# Check if number of iteration is non existent # Check if number of iteration is non existent
if (is.null(num_iteration)) { if (is.null(num_iteration)) {
...@@ -513,7 +514,11 @@ Booster <- R6::R6Class( ...@@ -513,7 +514,11 @@ Booster <- R6::R6Class(
} }
# Predict on new data # Predict on new data
predictor <- Predictor$new(private$handle, ...) params <- list(...)
predictor <- Predictor$new(
modelfile = private$handle
, params = params
)
return( return(
predictor$predict( predictor$predict(
data = data data = data
...@@ -531,7 +536,7 @@ Booster <- R6::R6Class( ...@@ -531,7 +536,7 @@ Booster <- R6::R6Class(
# Transform into predictor # Transform into predictor
to_predictor = function() { to_predictor = function() {
return(Predictor$new(private$handle)) return(Predictor$new(modelfile = private$handle))
}, },
# Used for save # Used for save
......
...@@ -27,8 +27,7 @@ Predictor <- R6::R6Class( ...@@ -27,8 +27,7 @@ Predictor <- R6::R6Class(
}, },
# Initialize will create a starter model # Initialize will create a starter model
initialize = function(modelfile, ...) { initialize = function(modelfile, params = list()) {
params <- list(...)
private$params <- lgb.params2str(params = params) private$params <- lgb.params2str(params = params)
handle <- NULL handle <- NULL
......
...@@ -132,7 +132,7 @@ lgb.train <- function(params = list(), ...@@ -132,7 +132,7 @@ lgb.train <- function(params = list(),
# Check for boosting from a trained model # Check for boosting from a trained model
if (is.character(init_model)) { if (is.character(init_model)) {
predictor <- Predictor$new(init_model) predictor <- Predictor$new(modelfile = init_model)
} else if (lgb.is.Booster(x = init_model)) { } else if (lgb.is.Booster(x = init_model)) {
predictor <- init_model$to_predictor() predictor <- init_model$to_predictor()
} }
......
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