> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ovalbee.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ovalbee.com/_mcp/server.

# Compare classifiers

> Compare two to five classifier evaluations on the same dataset. Produces a side-by-side report with overall and per-class metrics and names the winner.

Dockerfile

> **Note**
>
> First run can take longer while the worker pulls the configured Docker image.

## Overview

Puts two to five classifiers side by side on the same dataset and names the best one.

You pick the evaluations from one list, so comparing three or four models takes one node instead of a chain. The winner is chosen by the same model ranking that [Get best model](/node-library/nodes/models-general-get-best-model) uses, so both nodes always agree on which model is best. The winning model, its evaluation and its report come out as outputs, so the flow can carry on with it.

```mermaid
flowchart LR
  n1["Evaluate classifier"] --> n2["Compare classifiers"] --> n3["Export TIMM to ONNX"]
```

## Prerequisites

| Requirement        | What you need                                                                                                                             |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
| **Evaluations**    | Two to five evaluations from the [Evaluate classifier](/node-library/nodes/evaluate-evaluate-classifier) node, each with its report kept. |
| **Shared dataset** | All evaluations made on the same test or validation dataset, so the scores are comparable.                                                |

## How it works

Ranks the selected evaluations by **Metric** and picks the winner.

Reads each evaluation report and keeps only the images that every model scored.

Recomputes accuracy, macro F1, weighted F1 and per-class scores for every model on those images.

Publishes the comparison report along with the winner's model, evaluation and report.

## FAQ

#### Which metric decides the winner?

The one you pick in **Metric**: accuracy (the default), weighted F1 or macro F1. Set it to the same value as the classification Metric of Get best model, and both nodes pick the same model. Weighted F1 follows class sizes, while macro F1 gives every class the same weight, so it's the better choice when rare classes matter to you.

#### What happens when two models have the same score?

The older model wins. The run log says which models tied, on what value, and which one was kept.

#### Why can the report numbers differ from the evaluation numbers?

The winner comes from the scores each evaluation recorded. The report recomputes every score on the images all models share, so if one evaluation covered extra images, its report numbers can be a little different.

#### Why does the run fail with no common images?

The evaluations don't share a single image. Check that they were all made on the same dataset.

#### Why is an evaluation rejected?

The node needs the per-image results from an Evaluate classifier report. An evaluation that has no report, or whose report came from another node, can't be compared.

## Inputs

**`Evaluation dataset`** `dataset` — required

Test or validation dataset the classifiers were evaluated on. Key: `GT_DATASET`.

---

**`Classifier evaluations`** `model_evaluation` — required

Two to five evaluations of this dataset to compare, in any order. Values come from `GT_DATASET`. Key: `EVALUATIONS`.

---

**`Metric`** `select` — required, default: accuracy_top1

Evaluation metric that picks the winner. Bind it to the classification Metric of Get best model so both pick by the same rule. Key: `RANKING_METRIC`.

Options:

* Accuracy (`accuracy_top1`)
* Weighted F1 (`f1_weighted`)
* Macro F1 (`f1_macro`)

---

## Outputs

**`Report Asset`** `report`

Asset ID containing the comparison report. Shown as an artifact. Key: `REPORT_ID`.

---

**`Best Model ID`** `model`

Registry reference of the winning model (highest on Metric). Shown as an artifact. Key: `BEST_MODEL_ID`.

---

**`Winner framework`** `string`

Framework of the winning model, such as yolo, to branch on in a Router. Key: `WINNER_FRAMEWORK`.

---

**`Best Report ID`** `report`

Evaluation report asset ID of the winning model (can be passed to another Compare node). Key: `BEST_REPORT_ID`.

---

**`Best Evaluation ID`** `model_evaluation`

Evaluation of the winning model, ready to wire into another comparison. Key: `BEST_EVALUATION_ID`.

---

**`Winner`** `string`

Name of the winning model and its score on Metric. Shown on the node as a badge. Key: `WINNER`.

---

## Models and configuration

**Metric** is the only setting. The evaluation settings themselves come from the Evaluate classifier runs you select.

## Report

The comparison report opens in the preview widget:

* **Overview**: the winner and its score on **Metric**, then a table of accuracy, macro F1 and weighted F1 for every model.
* **Per-class comparison**: F1, precision and recall for each class, all models on one scale.
* **Change against the first model**: per-class F1 difference of every other model against the first one you picked.
* **Confusion matrices**: one per model, on the same class order.
* **Per-image results**: every image with each model's prediction, confidence and how many models got it right.

## Runtime

Runs on an ordinary worker. It reads a few reports and writes one, so it finishes quickly even on large datasets.

## JSON config

Machine-readable node interface for automation and advanced usage.

#### Show JSON

```json
{
  "name": "Compare classifiers",
  "description": "Compare two to five classifier evaluations on the same dataset. Produces a side-by-side report with overall and per-class metrics and names the winner.",
  "category": "Evaluate",
  "namespace": null,
  "templateKey": "evaluate/compare_classifiers",
  "version": "v2",
  "inputs": [
    {
      "key": "GT_DATASET",
      "label": "Evaluation dataset",
      "type": "dataset",
      "description": "Test or validation dataset the classifiers were evaluated on.",
      "required": true,
      "default": null,
      "visibleWhen": null,
      "options": {
        "creatable": false
      }
    },
    {
      "key": "EVALUATIONS",
      "label": "Classifier evaluations",
      "type": "model_evaluation",
      "description": "Two to five evaluations of this dataset to compare, in any order.",
      "required": true,
      "default": null,
      "visibleWhen": null,
      "options": {
        "ref": "GT_DATASET",
        "task_type": "classification",
        "minItems": 2,
        "maxItems": 5
      }
    },
    {
      "key": "RANKING_METRIC",
      "label": "Metric",
      "type": "select",
      "description": "Evaluation metric that picks the winner. Bind it to the classification Metric of Get best model so both pick by the same rule.",
      "required": true,
      "default": "accuracy_top1",
      "visibleWhen": null,
      "options": {
        "options": [
          {
            "label": "Accuracy",
            "value": "accuracy_top1"
          },
          {
            "label": "Weighted F1",
            "value": "f1_weighted"
          },
          {
            "label": "Macro F1",
            "value": "f1_macro"
          }
        ]
      }
    }
  ],
  "outputs": [
    {
      "key": "REPORT_ID",
      "label": "Report Asset",
      "type": "report",
      "description": "Asset ID containing the comparison report.",
      "artifact": true,
      "badge": false,
      "badgeOpens": null,
      "hidden": false
    },
    {
      "key": "BEST_MODEL_ID",
      "label": "Best Model ID",
      "type": "model",
      "description": "Registry reference of the winning model (highest on Metric).",
      "artifact": true,
      "badge": false,
      "badgeOpens": null,
      "hidden": false
    },
    {
      "key": "WINNER_FRAMEWORK",
      "label": "Winner framework",
      "type": "string",
      "description": "Framework of the winning model, such as yolo, to branch on in a Router.",
      "artifact": false,
      "badge": false,
      "badgeOpens": null,
      "hidden": false
    },
    {
      "key": "BEST_REPORT_ID",
      "label": "Best Report ID",
      "type": "report",
      "kind": "classification_evaluation_report_v1",
      "description": "Evaluation report asset ID of the winning model (can be passed to another Compare node).",
      "artifact": false,
      "badge": false,
      "badgeOpens": null,
      "hidden": false
    },
    {
      "key": "BEST_EVALUATION_ID",
      "label": "Best Evaluation ID",
      "type": "model_evaluation",
      "description": "Evaluation of the winning model, ready to wire into another comparison.",
      "artifact": false,
      "badge": false,
      "badgeOpens": null,
      "hidden": false
    },
    {
      "key": "WINNER",
      "label": "Winner",
      "type": "string",
      "description": "Name of the winning model and its score on Metric.",
      "artifact": false,
      "badge": true,
      "badgeOpens": null,
      "hidden": false
    }
  ],
  "runtime": {
    "type": "docker",
    "devices": [
      "cpu"
    ],
    "dockerImage": "ovalbee/node-classifier-inference:0.0.27"
  },
  "automation": {
    "requires_configuration": true
  },
  "widgets": {
    "widget": {
      "id": "report-preview",
      "settings": {
        "reportAsset": {
          "type": "variable",
          "value": "self.outputs.REPORT_ID"
        },
        "name": {
          "type": "input",
          "value": "Open comparison"
        }
      }
    }
  }
}
```

## References

#### Sources and related pages

* [Evaluate classifier](/node-library/nodes/evaluate-evaluate-classifier) records the evaluations and reports this node compares.
* [Get best model](/node-library/nodes/models-general-get-best-model) ranks models by the same rule.