Learn R Programming

datarobot (version 2.8.0)

GetPredictions: Retrieve model predictions from predictJobId

Description

This function is called with a project descriptor and an integer predictJobId, obtained from an earlier call to RequestPredictions. It returns the predictions generated for the model and data specified in this prior function call.

Usage

GetPredictions(project, predictJobId, type = "response",
  classPrefix = "class_", maxWait = 600)

Arguments

project

character. Either (1) a character string giving the unique alphanumeric identifier for the project, or (2) a list containing the element projectId with this identifier.

predictJobId

integer. Id identifying the prediction job created by the call to RequestPredictions.

type

character. String specifying the type of response for binary classifiers; see Details.

classPrefix

character. For multiclass projects returning prediction probabilities, this prefix is prepended to each class in the header of the dataframe. Defaults to "class_".

maxWait

integer. The maximum time (in seconds) to wait for the prediction job to complete.

Value

Vector of predictions, depending on the modeling task ("Binary", "Multiclass", or "Regression") and the value of the type parameter; see Details.

Details

The contents of the return vector depends on both the modeling task - binary classification, multiclass classification, or regression - and the value of the type parameter. For regression tasks, the type parameter is ignored and a vector of numerical predictions of the response variable is returned.

For binary classification tasks, either a vector of predicted responses is returned if type has the value "response" (the default), or a vector of probabilities for the positive class is returned, if type is "probability".

For multiclass classification tasks, "response" will return the predicted class and "probability" will return the probability of each class.

This function will error if the requested job has errored, or if it isn't complete within maxWait seconds.

Examples

Run this code
# NOT RUN {
  projectId <- "59a5af20c80891534e3c2bde"
  initialJobs <- GetPredictJobs(project)
  job <- initialJobs[[1]]
  predictJobId <- job$predictJobId
  GetPredictions(projectId, predictJobId)
# }

Run the code above in your browser using DataLab