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(
#' @title Predict method for LightGBM model
#' @description Predicted values based on 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)
#' @param start_iteration int or None, optional (default=None)
#' Start index of the iteration to predict.
......@@ -779,7 +779,7 @@ Booster <- R6::R6Class(
#' @importFrom utils modifyList
#' @export
predict.lgb.Booster <- function(object,
data,
newdata,
start_iteration = NULL,
num_iteration = NULL,
rawscore = FALSE,
......@@ -805,7 +805,7 @@ predict.lgb.Booster <- function(object,
return(
object$predict(
data = data
data = newdata
, start_iteration = start_iteration
, num_iteration = num_iteration
, rawscore = rawscore
......
......@@ -6,7 +6,7 @@
\usage{
\method{predict}{lgb.Booster}(
object,
data,
newdata,
start_iteration = NULL,
num_iteration = NULL,
rawscore = FALSE,
......@@ -21,7 +21,7 @@
\arguments{
\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)}
\item{start_iteration}{int or None, optional (default=None)
......
......@@ -79,7 +79,7 @@ test_that("start_iteration works correctly", {
, early_stopping_rounds = 2L
)
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)
pred2 <- rep(0.0, length(pred1))
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