> ## 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**: development (Continuously evaluate your models and datasets as you iterate on their versions.)
  and monitoring (Monitor a model in production, measure its health, check for drifts and set up alerts.).

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

```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",
        "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",
        "measurement": "geometricMean",
        "operator": ">",
        "value": 0.75
      }
    ],
    "subpopulationFilters": null,
    "mode": "monitoring",
    "usesProductionData": true,
    "evaluationWindow": 3600,
    "delayWindow": 0,
    "syncId": "b4dee7dc-4f15-48ca-a282-63e2c04e0689"
  }
]
```

## Related

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


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.