Skip to main content

SHAP

The SHAP command takes an SQL-inf command as input and outputs a shap value for each row of the output and each column of the input data the inner SQL-inf command. These Shap values can be used to build an explanation of the inner SQL-inf command.

Syntax

SHAP(<SQL-inf command> [, )
  • SQL-inf command is a well-defined SQL-inf command.

Options

  • cls defines which class to explain, if the SQL-inf command defines a classification command, like PREDICT, SENTIMENT or TOPICS, the cls option is required.

Returns

A column for each input feature and each input row with a number representing how much that feature contributed to the outcome of the inner SQL-inf command.

The output columns are named after the input columns with the prefix shap_.

Examples

Explain how all other fields in the table customers contributed to the prediction of churn per row.

SELECT * FROM customers SHAP(PREDICT(churn), cls=1)