Unverified Commit 9307d538 authored by david-cortes's avatar david-cortes Committed by GitHub
Browse files

[R-package] Rename `data` -> `newdata` in `predict()` (#4973)

parent faccbb8e
...@@ -713,7 +713,7 @@ Booster <- R6::R6Class( ...@@ -713,7 +713,7 @@ Booster <- R6::R6Class(
#' @title Predict method for LightGBM model #' @title Predict method for LightGBM model
#' @description Predicted values based on class \code{lgb.Booster} #' @description Predicted values based on class \code{lgb.Booster}
#' @param object Object of class \code{lgb.Booster} #' @param object Object of class \code{lgb.Booster}
#' @param data a \code{matrix} object, a \code{dgCMatrix} object or #' @param newdata a \code{matrix} object, a \code{dgCMatrix} object or
#' a character representing a path to a text file (CSV, TSV, or LibSVM) #' a character representing a path to a text file (CSV, TSV, or LibSVM)
#' @param start_iteration int or None, optional (default=None) #' @param start_iteration int or None, optional (default=None)
#' Start index of the iteration to predict. #' Start index of the iteration to predict.
...@@ -779,7 +779,7 @@ Booster <- R6::R6Class( ...@@ -779,7 +779,7 @@ Booster <- R6::R6Class(
#' @importFrom utils modifyList #' @importFrom utils modifyList
#' @export #' @export
predict.lgb.Booster <- function(object, predict.lgb.Booster <- function(object,
data, newdata,
start_iteration = NULL, start_iteration = NULL,
num_iteration = NULL, num_iteration = NULL,
rawscore = FALSE, rawscore = FALSE,
...@@ -805,7 +805,7 @@ predict.lgb.Booster <- function(object, ...@@ -805,7 +805,7 @@ predict.lgb.Booster <- function(object,
return( return(
object$predict( object$predict(
data = data data = newdata
, start_iteration = start_iteration , start_iteration = start_iteration
, num_iteration = num_iteration , num_iteration = num_iteration
, rawscore = rawscore , rawscore = rawscore
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
\usage{ \usage{
\method{predict}{lgb.Booster}( \method{predict}{lgb.Booster}(
object, object,
data, newdata,
start_iteration = NULL, start_iteration = NULL,
num_iteration = NULL, num_iteration = NULL,
rawscore = FALSE, rawscore = FALSE,
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
\arguments{ \arguments{
\item{object}{Object of class \code{lgb.Booster}} \item{object}{Object of class \code{lgb.Booster}}
\item{data}{a \code{matrix} object, a \code{dgCMatrix} object or \item{newdata}{a \code{matrix} object, a \code{dgCMatrix} object or
a character representing a path to a text file (CSV, TSV, or LibSVM)} a character representing a path to a text file (CSV, TSV, or LibSVM)}
\item{start_iteration}{int or None, optional (default=None) \item{start_iteration}{int or None, optional (default=None)
......
...@@ -79,7 +79,7 @@ test_that("start_iteration works correctly", { ...@@ -79,7 +79,7 @@ test_that("start_iteration works correctly", {
, early_stopping_rounds = 2L , early_stopping_rounds = 2L
) )
expect_true(lgb.is.Booster(bst)) expect_true(lgb.is.Booster(bst))
pred1 <- predict(bst, data = test$data, rawscore = TRUE) pred1 <- predict(bst, newdata = test$data, rawscore = TRUE)
pred_contrib1 <- predict(bst, test$data, predcontrib = TRUE) pred_contrib1 <- predict(bst, test$data, predcontrib = TRUE)
pred2 <- rep(0.0, length(pred1)) pred2 <- rep(0.0, length(pred1))
pred_contrib2 <- rep(0.0, length(pred2)) pred_contrib2 <- rep(0.0, length(pred2))
......
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