Classification

Predict a category: set-up, metrics, plots and algorithms for binary and multiclass problems.

Classification predicts which category a row belongs to. The target column holds a small set of labels, for example left (0 or 1) or a customer segment such as basic, plus, premium. With two labels the task is binary; with three or more it is multiclass. mlflow handles both with the same screens.

When to use it

Use classification when the answer you want is a label, not a quantity:

  • Will this customer leave? Is this transaction fraudulent? (binary)
  • Which product category does this ticket belong to? (multiclass)

If the target is a number such as a price, use Regression. If you have no target column, see Clustering or Anomaly detection.

Set it up

Create the pipeline

In your project, open Pipelines, select New and then New pipeline. Type a Name, set Task to Classification, pick the Dataset and the Target column, and select Create pipeline.

The Dataset list in this dialog shows only data sources that were added as CSV files. Excel and Parquet sources can be added to a workspace but do not appear here yet.

Add preprocessing steps

In the Columns part, press Choose... on columns to fill missing values, turn categories into numbers and scale numbers. See Preprocessing steps. Suggested: rows and the Recommendations panel propose steps from the dataset profile.

Choose algorithms and validation

Open the Models part of the pipeline editor. Tick one or more algorithms (see Algorithms catalog) and set the Cross-validation card:

  • CV folds: from 2 to 20. The default is 10.
  • Fold strategy: Stratified k-fold (the default for classification), K-fold, Group k-fold or Stratified group k-fold. Stratified strategies keep each class's share the same in every fold.
  • Group column: optional; see Cross-validation and group folds.

Select Train N models.

By default the engine keeps 70 percent of the rows for training and holds out the remaining 30 percent. Cross-validation runs on the training rows; the holdout rows are used for the evaluation plots.

Metrics

The leaderboard has one column per metric: Accuracy, AUC, Recall, Prec., F1, Kappa and MCC. For a binary target, Recall, Prec. and F1 score the positive class. For a multiclass target they are averaged over the classes, weighted by how many rows each class has, and AUC is computed one class against the rest, also weighted. All metrics are higher-is-better. Every value is the mean over the cross-validation folds. The caption above the table says which metric the table is ranked by; select another column header to sort by it. Details are in Metrics reference.

Plots

Open a model from the leaderboard with View details to see its plots, grouped in tabs.

TabPlots
DiagnosticsConfusion matrix, ROC curve, Precision–Recall, Class distribution
ExplainabilityFeature importance, Permutation importance
CurvesCalibration, Threshold sweep, Lift, Gain

Calibration, Threshold sweep, Lift and Gain are only available for binary targets. Most plots need the model's saved pipeline; if a plot says the model has no saved pipeline, promote the model first from the run page.

Algorithms

The catalog has linear models, nearest neighbours, support vector machines, naive Bayes, discriminant analysis, decision trees, forests, boosting, neural networks and a dummy baseline. Gradient-boosting libraries and the deep-learning models appear only when the server has them installed. The full list with ids is in the Algorithms catalog.

Every run also trains a Baseline reference model. It is shown on the leaderboard but is never ranked and cannot be deployed. A model that does not clearly beat the baseline has learned little.

Imbalanced classes

When one class is much rarer than the others, accuracy can look high for a model that never predicts the rare class. When the target is imbalanced, the data profile warns you: a warning at a majority-to-minority ratio of 3 or more, and an error level at 10 or more. The warning text suggests judging the run with F1, balanced accuracy or AUC and keeping the split stratified. The default Stratified k-fold strategy already does that for the folds.

In mlflow you can address imbalance in three places: choose a metric that respects the minority class, set a class-weight parameter on algorithms that offer one (switch the algorithm to Manual and look for class_weight), and inspect the Threshold sweep plot to move the decision threshold.

Probabilities and thresholds

Most classifiers can output a probability per class, not only a label. The endpoint of a deployed model returns a probability for each class when the model provides them. By default a row gets the label with the highest probability. The Threshold sweep plot shows how precision and recall change as the cut-off moves, which helps when a missed positive costs more than a false alarm.

Next steps

Learn the theory

Lessons on learning.mlflow.es that explain the ideas behind this page.

Updated 2026-11-22