> ## 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.

# Geometric mean

> Learn how to use the geometric mean test

## Definition

The geometric mean test measures the geometric mean of the precision and the recall. This metric provides a balanced measure that considers both precision and recall performance, calculated as the square root of their product.

## 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

* Geometric mean provides an alternative to F1 score for balancing precision and recall, particularly useful when both metrics are equally important.
* It's more sensitive to low values than arithmetic mean, making it effective at identifying models with poor performance in either precision or recall.
* Higher geometric mean values indicate better balanced performance, with 1.0 representing perfect precision and recall.
* This metric is particularly valuable for imbalanced datasets where you want to ensure good performance on both classes.

## 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 geometric mean test:

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

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

## Related

* [F1 test](/tests/catalog/f1) - Harmonic mean of precision and recall.
* [Precision test](/tests/catalog/precision) - Measure positive prediction accuracy.
* [Recall test](/tests/catalog/recall) - Measure ability to find all positive instances.
* [Accuracy test](/tests/catalog/accuracy) - Overall classification correctness.
* [Aggregate metrics](/tests/performance/aggregate-metrics) - Overview of all available metrics.
