
Last chance! 50% off unlimited learning
Sale ends in
This function can be used to predict with a particular model.
Predict(
model,
predictionDataset,
classPrefix = "class_",
maxWait = 600,
forecastPoint = NULL,
predictionsStartDate = NULL,
predictionsEndDate = NULL,
type = "response",
includePredictionIntervals = FALSE,
predictionIntervalsSize = NULL
)
Vector of predictions, depending on the modeling task ("Binary", "Multiclass", or "Regression") and the value of the type parameter; see Details.
An S3 object of class dataRobotModel like that returned by the function GetModel, or each element of the list returned by the function ListModels.
object. Either a dataframe of data to predict on or a DataRobot
prediction dataset object of class dataRobotPredictionDataset
.
character. For multiclass projects returning prediction probabilities, this prefix is prepended to each class in the header of the dataframe. Defaults to "class_".
integer. The maximum time (in seconds) to wait for the prediction job to complete.
character. Optional. The point relative to which predictions will be generated, based on the forecast window of the project. Only specified in time series projects.
datetime. Optional. Only specified in time series projects.
The start date for bulk predictions. Note that this parameter is for generating
historical predictions using the training data. This parameter should be provided in
conjunction predictionsEndDate
. Can't be provided with forecastPoint
parameter.
datetime. Optional. Only specified in time series projects.
The end date for bulk predictions. Note that this parameter is for generating
historical predictions using the training data. This parameter should be provided
in conjunction predictionsStartDate
. Can't be provided with forecastPoint
parameter.
character. String specifying the type of response for binary classifiers; see Details.
logical. Optional. Should prediction intervals bounds should be part of predictions? Only available for time series projects. See "Details" for more info.
numeric. Optional. Size of the prediction intervals, in percent. Only available for time series projects. See "Details" for more info.
The contents of the return vector depends on the modeling task - binary classification, multiclass classification, or regression; whether or not the underlying data is time series, multiseries, cross-series, or not time series; and the value of the /codetype parameter. For non-time-series regression tasks, the type parameter is ignored and a vector of numerical predictions of the response variable is returned.
This function will error if the requested job has errored or
if it has not completed within maxWait
seconds.
See RequestPredictions
and GetPredictions
for more details.
if (FALSE) {
trainIndex <- sample(nrow(iris) * 0.7)
trainIris <- iris[trainIndex, ]
testIris <- iris[-trainIndex, ]
project <- StartProject(trainIris, "iris", target = "Petal_Width", wait = TRUE)
model <- GetRecommendedModel(project)
predictions <- Predict(model, testIris)
# Or, if prediction intervals are desired (datetime only)
model <- GetRecommendedModel(datetimeProject)
predictions <- Predict(model,
dataset,
includePredictionIntervals = TRUE,
predictionIntervalsSize = 100,
type = "raw")
}
Run the code above in your browser using DataLab