---
title: "meanAbsoluteError(_:_:)"
framework: createmlcomponents
role: symbol
role_heading: Function
path: "createmlcomponents/meanabsoluteerror(_:_:)"
---

# meanAbsoluteError(_:_:)

Computes the mean absolute error between predicted and ground truth values.

## Declaration

```swift
@backDeployed(before: macOS 14.0, iOS 17.0, tvOS 17.0)
func meanAbsoluteError<T>(_ predicted: some Collection, _ groundTruth: some Collection) -> T where T : FloatingPoint
```

## Parameters

- `predicted`: The predicted values.
- `groundTruth`: The ground truth values. The collection must have same number of elements as the predicted values.

## Return Value

Return Value The mean absolute error.

## Discussion

Discussion Empty collections of predicted and ground truth values will return a value of NaN.

## See Also

### Metrics

- [Classification](createmlcomponents/classification.md)
- [ClassificationDistribution](createmlcomponents/classificationdistribution.md)
- [ClassificationMetrics](createmlcomponents/classificationmetrics.md)
- [MultiLabelClassificationMetrics](createmlcomponents/multilabelclassificationmetrics.md)
- [rootMeanSquaredError(_:)](createmlcomponents/rootmeansquarederror(_:).md)
- [rootMeanSquaredError(_:_:)](createmlcomponents/rootmeansquarederror(_:_:).md)
- [maximumAbsoluteError(_:)](createmlcomponents/maximumabsoluteerror(_:).md)
- [maximumAbsoluteError(_:_:)](createmlcomponents/maximumabsoluteerror(_:_:).md)
- [meanAbsoluteError(_:)](createmlcomponents/meanabsoluteerror(_:).md)
- [meanAbsolutePercentageError(_:)](createmlcomponents/meanabsolutepercentageerror(_:).md)
- [meanSquaredError(_:)](createmlcomponents/meansquarederror(_:).md)
- [meanSquaredError(_:_:)](createmlcomponents/meansquarederror(_:_:).md)
