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

# Log loss

> Learn how to use the log loss test

## Definition

The log loss test measures the dissimilarity between predicted probabilities and the true distribution. Also known as cross-entropy loss or binary cross-entropy (in the binary classification case), it evaluates how well the model's predicted probabilities match the actual class labels.

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

* Log loss provides a probabilistic measure of classification performance, considering not just correctness but also confidence in predictions.
* It heavily penalizes confident wrong predictions, making it sensitive to model calibration and overconfidence.
* Lower log loss values indicate better model performance, with 0 representing perfect probability predictions.
* This metric is particularly valuable when you need well-calibrated probability estimates, not just class predictions.

## Required columns

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

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

<Note>
  Log loss requires predicted probabilities, not just class labels. Ensure your
  model outputs probability estimates for each class.
</Note>

## Test configuration examples

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

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

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

## Related

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