Product DocumentationAPI and Python SDK ReferenceRelease Notes
Schedule a Demo
Schedule a Demo

Multiclass Classification

Multiclass classification models predict one class from more than two potential classes. In Arthur, these models fall into the category of classification and are represented by the Multiclass model type.

Some common examples of Text multiclass classification are:

  • Is the sentiment of this tweet neutral, positive, or negative?
  • What category does this document fall into?

Similar to binary classification, these models frequently output not only the predicted class but also a probability for each class predicted. The highest probability class is then the predicted output. In these cases, a threshold does not need to be provided to Arthur and it will automatically track the highest probability class as the predicted output.

Formatted Data in Arthur

Text multiclass classification models require three things to be specified in their schema: text input, predicted probability of outputs, and a column for the inference's true label (or ground truth). Many teams also choose to onboard metadata for the model (i.e. any information you want to track about your inferences) as non-input attributes.

Attribute (Text Input)Probability of Prediction AProbability of Prediction BProbability of Prediction CGround TruthNon-Input Attribute (numeric or categorical)
Alea iacta est.90.05.05AMale
Castigat ridendo mores..46.14.40BFemale
Plenus venter non studet libenter..16.17.71CFemale

Predict Function and Mapping

These are some examples of common values teams need to onboard for their multi-class classification models.

The relationship between the prediction and ground truth column must be defined to help set up your Arthur environment to calculate default performance metrics. There are 2 options for formatting this, depending on your reference dataset. Additionally, if teams wish to enable explainability, they must provide a few Assets Required For Explainability. Below is an example of the runnable predict function, which outputs a single numeric prediction.

## Option 1:  Multiple Prediction Columns, Single Ground Truth Column
# Map each PredictedValue attribute to its corresponding GroundTruth value.
output_mapping_1 = {

# Build Arthur Model with this Technique,

## Option 2:  Multiple Prediction and Ground Truth Columns
# Map each PredictedValue attribute to its corresponding GroundTruth attribute.
output_mapping_2 = {

# Build Arthur Model with this Technique,
## Example prediction function for binary classification

def predict(x):
  return model.predict_proba(x)

Available Metrics

When onboarding tabular classification models, you have a number of default metrics available to you within the UI. You can learn more about each specific metric in the metrics section of the documentation.

Out-of-the-Box Metrics

The following metrics are automatically available in the UI (out-of-the-box) per class when teams onboard a multiclass classification model. Find out more about these metrics in the Performance Metrics section.

MetricMetric Type
Accuracy RatePerformance
Balanced Accuracy RatePerformance
Specificity (TNR)Performance
False Positive RatePerformance
False Negative RatePerformance
Inference CountIngestion
Inference Count by ClassIngestion

Drift Metrics

In the platform, drift metrics are calculated compared to a reference dataset. So, once a reference dataset is onboarded for your model, these metrics are available out of the box for comparison. Find out more about these metrics in the Drift and Anomaly section.

Of note, for unstructured data types (like text and image), feature drift is calculated for non-input attributes. The actual input to the model (in this case text) drift is calculated with multivariate drift to accommodate the multivariate nature/relationships within the data type.

PSIFeature Drift
KL DivergenceFeature Drift
JS DivergenceFeature Drift
Hellinger DistanceFeature Drift
Hypothesis TestFeature Drift
Prediction DriftPrediction Drift
Multivariate DriftMultivariate Drift

Note: Teams are able to evaluate drift for inference data at different intervals with our Python SDK and query service (for example data coming into the model now, compared to a month ago).

Fairness Metrics

As further described in the Fairness Metrics section of the documentation, fairness metrics are available for any tabular Arthur attributes manually selected to monitor for bias. For text models, however, the only attribute required to onboard a model is the image attribute. So, it is only possible to monitor non-input attributes for fairness in image models.

MetricMetric Type
Accuracy RateFairness
True Positive Rate (Equal Opportunity)Fairness
True Negative RateFairness
False Positive RateFairness
False Negative RateFairness

User-Defined Metrics

Whether your team uses a different performance metric, wants to track defined segments of data, or needs logical functions to create a metric for external stakeholders (like product or business metrics). Learn more about creating metrics with data in Arthur in the User-Defined Metrics section.

Available Enrichments

The following enrichments can be enabled for this model type:

Anomaly DetectionHot SpotsExplainabilityBias Mitigation