Skip to main content

EXPLAIN

The EXPLAIN command takes an SQL-inf command as input and outputs an "explanation" of the output of the inner SQL-inf command.

The output will be a number for each input feature to the inner SQL-inf command. In the case of the inner SQL-inf command being a PREDICT on a classification the output will have a row for each class, otherwise the output will have a single row.

Syntax

EXPLAIN(<SQL-inf command>)
  • SQL-inf command is a well-defined SQL-inf command.

Options

  • include_metrics can be set to include extra metrics, like accuracy, recall, r2, mse etc
  • ignore can be used to specify columns (as a comma separated list) returned by the SELECT statement but which you want the EXPLAIN to ignore.

Returns

A column for each input feature 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.

In the case of the inner SQL-inf command being a PREDICT on a classification the output will have a row for each class, otherwise the output will have a single row.

Examples

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

SELECT * FROM customers EXPLAIN(PREDICT(churn))

Explain how the columns country and age in the table customers contributed to the prediction of churn.

SELECT country, age, churn FROM customers EXPLAIN(PREDICT(churn))

Explain the clusters created using the customers table.

SELECT * FROM customers EXPLAIN(CLUSTER)