> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openlayer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Accuracy

> Learn how to use the accuracy test

## Definition

The accuracy test measures the classification accuracy, defined as the ratio of the number of correctly classified samples and the total number of samples. Accuracy provides an overall measure of how often the classifier makes correct predictions.

## Taxonomy

* **Task types**: Tabular classification, text classification.
* **Availability**: <Tooltip tip="Continuously evaluate your models and datasets as you iterate on their versions.">development</Tooltip>
  and <Tooltip tip="Monitor a model in production, measure its health, check for drifts and set up alerts.">monitoring</Tooltip>.

## Why it matters

* Accuracy is one of the most intuitive and commonly used metrics for evaluating classification performance.
* It provides a single number that represents the overall correctness of the model across all classes.
* Higher accuracy values indicate better model performance, with 1.0 representing perfect classification.
* However, accuracy can be misleading in cases of class imbalance, where other metrics like precision, recall, or F1 might be more appropriate.

## Required columns

To compute this metric, your dataset must contain the following columns:

* **Predictions**: The predicted class labels from your classification model
* **Ground truths**: The actual/true class labels

## Test configuration examples

If you are writing a `tests.json`, here are a few valid configurations for the accuracy test:

<CodeGroup>
  ```json Development theme={null}
  [
    {
      "name": "Accuracy above 0.85",
      "description": "Ensure that the classification accuracy is above 0.85",
      "type": "performance",
      "subtype": "metricThreshold",
      "thresholds": [
        {
          "insightName": "metrics",
          "insightParameters": null,
          "measurement": "accuracy",
          "operator": ">",
          "value": 0.85
        }
      ],
      "subpopulationFilters": null,
      "mode": "development",
      "usesValidationDataset": true,
      "usesTrainingDataset": false,
      "usesMlModel": true,
      "syncId": "b4dee7dc-4f15-48ca-a282-63e2c04e0689"
    }
  ]
  ```

  ```json Monitoring theme={null}
  [
    {
      "name": "Accuracy above 0.85",
      "description": "Ensure that the classification accuracy is above 0.85",
      "type": "performance",
      "subtype": "metricThreshold",
      "thresholds": [
        {
          "insightName": "metrics",
          "insightParameters": null,
          "measurement": "accuracy",
          "operator": ">",
          "value": 0.85
        }
      ],
      "subpopulationFilters": null,
      "mode": "monitoring",
      "usesProductionData": true,
      "evaluationWindow": 3600,
      "delayWindow": 0,
      "syncId": "b4dee7dc-4f15-48ca-a282-63e2c04e0689"
    }
  ]
  ```
</CodeGroup>

## Related

* [Precision test](/tests/catalog/precision) - Measure positive prediction accuracy.
* [Recall test](/tests/catalog/recall) - Measure ability to find all positive instances.
* [F1 test](/tests/catalog/f1) - Harmonic mean of precision and recall.
* [ROC AUC test](/tests/catalog/roc-auc) - Area under the receiver operating characteristic curve.
* [Aggregate metrics](/tests/performance/aggregate-metrics) - Overview of all available metrics.
