Learn R Programming

datarobot (version 2.18.6)

RequestPredictionExplanations: Request prediction explanations computation for a specified model and dataset.

Description

In order to create PredictionExplanations for a particular model and dataset, you must first: Compute feature impact for the model via RequestFeatureImpact() Compute a PredictionExplanationsInitialization for the model via RequestPredictionExplanationsInitialization() Compute predictions for the model and dataset via'RequestPredictions() After prediction explanations are requested information about them can be accessed using the functions GetPredictionExplanationsMetadataFromJobId and GetPredictionExplanationsMetadata. Prediction explanations themselves can be accessed using the functions GetPredictionExplanationsRows, GetPredictionExplanationsRowsAsDataFrame, and DownloadPredictionExplanations.

Usage

RequestPredictionExplanations(
  model,
  datasetId,
  maxExplanations = NULL,
  thresholdLow = NULL,
  thresholdHigh = NULL
)

Value

job Id

Arguments

model

An S3 object of class dataRobotModel like that returned by the function GetModel, or each element of the list returned by the function ListModels.

datasetId

character. ID of the prediction dataset for which prediction explanations are requested.

maxExplanations

integer. Optional. The maximum number of prediction explanations to supply per row of the dataset, default: 3.

thresholdLow

numeric. Optional. The lower threshold, below which a prediction must score in order for prediction explanations to be computed for a row in the dataset. If neither threshold_high nor threshold_low is specified, prediction explanations will be computed for all rows.

thresholdHigh

numeric. Optional. The high threshold, above which a prediction must score in order for prediction explanations to be computed. If neither threshold_high nor threshold_low is specified, prediction explanations will be computed for all rows.

Details

thresholdHigh and thresholdLow are optional filters applied to speed up computation. When at least one is specified, only the selected outlier rows will have prediction explanations computed. Rows are considered to be outliers if their predicted value (in case of regression projects) or probability of being the positive class (in case of classification projects) is less than threshold_low or greater than thresholdHigh. If neither is specified, prediction explanations will be computed for all rows.

Examples

Run this code
if (FALSE) {
  projectId <- "59a5af20c80891534e3c2bde"
  modelId <- "5996f820af07fc605e81ead4"
  datasets <- ListPredictionDatasets(projectId)
  dataset <- datasets[[1]]
  datasetId <- dataset$id
  model <- GetModel(projectId, modelId)
  RequestPredictionExplanations(model, datasetId)
}

Run the code above in your browser using DataLab