# Classifier Explain Function

This function explains how a classifier model previously trained by a classifier.train procedure type produced its output, allowing for feedback on which features were causing the classifier result.

## Configuration

A new function of type classifier.explain named <id> can be created as follows:

mldb.put("/v1/functions/"+<id>, {
"type": "classifier.explain",
"params": {
"modelFileUrl": <Url>
}
})

with the following key-value definitions for params:

Field, Type, DefaultDescription

modelFileUrl
Url

URL of the model file (with extension '.cls') to load. This file is created by the classifier.train procedure type.

## Input and Output Values

Functions of this type have two input values: label which is a scalar expression and features which is a row. The value of label should be compatible with the labels used to train the classifier. The columns that are expected in the feature row depend on the features that were trained into the classifier. For example, if in the training the input was "select": "x,y", then the function will expect two columns called x and y.

These functions output two values, explanation which returns a row and bias which returns a float. The explanation row contains a column for each feature which influenced the classifier's output for this input, the value of which is a numerical score for the influence of that feature in this case. The sum of the value of the bias column and the influence of each feature is the score that the classifier assigns to the input feature vector. This means that the higher the influence assigned to a given value of a feature (in the context of the others), the more that feature contributes to the score, and the heavier that feature weighs in favour of the label. Negative values indicate that the feature value in question pushes the classifier away from assigning the label. The bias value is the score the classifier would assign in the absence of any features.