Skip to content

Classification Workflow

Show a classifier report with class labels and probabilities.

import { predictionTransport } from "./prediction-transport";
mountForm(container, {
transport: predictionTransport,
schema: {
fields: [{ id: "text", kind: "text", label: "Text", mappedTo: "text", required: true }],
reports: [
{
id: "intent",
kind: "classifier",
label: "Intent",
mappedTo: "intent",
labels: ["support", "sales", "other"],
showClassProbabilities: true,
},
],
},
});

Response:

{
"reports": [
{
"backend": "default",
"mappedTo": "intent",
"status": "ready",
"payload": {
"prediction": "support",
"probabilities": [0.88, 0.07, 0.05]
}
}
]
}

Expected UI behavior: the report renders only after submit and can show class probabilities when the payload includes them.

Mistakes to avoid:

Mistake Fix
Using display labels as backend keys Use stable report ids.
Hiding class probabilities in the schema Set showClassProbabilities: true or omit it to use the default.

Next: Regression Workflow.