GetPredictionExplanationsRows: Retrieve all prediction explanations rows

View source: R/PredictionExplanations.R

GetPredictionExplanationsRowsR Documentation

Retrieve all prediction explanations rows

Description

Retrieve all prediction explanations rows

Usage

GetPredictionExplanationsRows(
  project,
  predictionExplanationId,
  batchSize = NULL,
  excludeAdjustedPredictions = TRUE
)

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.

predictionExplanationId

character. Id of the prediction explanations.

batchSize

integer. Optional. Maximum number of prediction explanations rows to retrieve per request

excludeAdjustedPredictions

logical. Optional. Set to FALSE to include adjusted predictions, which are predictions adjusted by an exposure column. This is only relevant for projects that use an exposure column.

Value

list of raw prediction explanations, each element corresponds to a row of the prediction dataset and has following components.

  • rowId. Character string row Id.

  • prediction. prediction for the row.

  • predictionValues. list containing

    • label. describes what this model output corresponds to. For regression projects, it is the name of the target feature. For classification projects, it is a level from the target feature.

    • value. the output of the prediction. For regression projects, it is the predicted value of the target. For classification projects, it is the predicted probability the row belongs to the class identified by the label.

  • adjustedPrediction. adjusted predictions, if they are not excluded.

  • adjustedPredictionValues. Similar to predictionValues, but for adjusted predictions, if they are not excluded.

  • predictionExplanations. list containing

    • label. described what output was driven by this prediction explanation. For regression projects, it is the name of the target feature. For classification projects, it is the class whose probability increasing would correspond to a positive strength of this prediction explanation.

    • feature. the name of the feature contributing to the prediction.

    • featureValue. the value the feature took on for this row

    • strength. the amount this feature's value affected the prediction

    • qualitativeStrength. a human-readable description of how strongly the feature affected the prediction (e.g. '+++', '–', '+').

Examples

## Not run: 
  projectId <- "59a5af20c80891534e3c2bde"
  modelId <- "5996f820af07fc605e81ead4"
  datasets <- ListPredictionDatasets(projectId)
  dataset <- datasets[[1]]
  datasetId <- dataset$id
  model <- GetModel(projectId, modelId)
  jobId <- RequestPredictionExplanations(model, datasetId)
  predictionExplanationId <- GetPredictionExplanationsMetadataFromJobId(projectId, jobId)$id
  GetPredictionExplanationsRows(projectId, predictionExplanationId)

## End(Not run)

datarobot documentation built on May 6, 2022, 5:06 p.m.