IDAX.CONFUSION_MATRIX - Build a confusion matrix

Use this stored procedure to build a confusion matrix for classification predictions. The calculation is based on the comparison of the predictions that are made when a classification model is applied on data, and on the real values for this data.

Note: This feature is available starting from Db2® version 11.5.4.

Authorization

The privileges held by the authorization ID of the statement must include the IDAX_USER role.

Syntax

IDAX.CONFUSION_MATRIX(in parameter_string varchar(32672))

Parameter descriptions

parameter_string
Mandatory one-string parameter that contains pairs of <parameter>=<value> entries that are separated by a comma.
Data type: VARCHAR(32672)
The following list shows the parameter values:
intable
Mandatory.
The input table that contains real values.
Data type: VARCHAR(128)
id
Mandatory.
The column of the input table that identifies a unique instance ID.
Data type: VARCHAR(128)
target
Mandatory.
The column of the input table that contains real values.
Data type: VARCHAR(128)
resulttable
Mandatory.
The name of the input table that contains the predicted values.
Data type: VARCHAR(128)
resultid
Optional.
The column of the input table column that identifies a unique instance ID.
Default: "ID"
Data type: VARCHAR(128)
resulttarget
Optional.
The column of the input table that contains real values.
Default: "CLASS"
Data type: VARCHAR(128)
matrixTable
Mandatory.
The output table where the confusion matrix is stored.
Data type: VARCHAR(128)

Returned information

The number of rows that are written to the output table of the confusion matrix as a result set.

The output table that contains the confusion matrix has the following columns:

real
The real values of the data.
prediction
The predictions of the classification model for the data.
cnt
The frequency of a prediction for a real value.

Example

CALL IDAX.CONFUSION_MATRIX('intable=IDAX.CensusIncome_test, resulttable=CensusIncome_income_nb_ewnd, id=id, target=income, 
matrixTable=ci_income_nb_ewnd_cm');