Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dms-codes/mean-absolute-error
https://github.com/dms-codes/mean-absolute-error
Last synced: 2 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/dms-codes/mean-absolute-error
- Owner: dms-codes
- Created: 2024-12-07T01:36:09.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-12-07T01:40:47.000Z (about 1 month ago)
- Last Synced: 2024-12-07T02:25:18.967Z (about 1 month ago)
- Language: Python
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mean Absolute Error (MAE) Calculation
This Python function calculates the Mean Absolute Error (MAE) between two lists of values.
def mean_absolute_error(actual, calculated):
"""
Calculates the Mean Absolute Error (MAE) between two lists.Args:
actual: A list of actual values.
calculated: A list of calculated values.Returns:
The Mean Absolute Error.Raises:
ValueError: If the lengths of the input lists are not equal.
"""
if len(actual) != len(calculated):
raise ValueError("Actual and calculated lists must have the same length.")errors = [abs(a - c) for a, c in zip(actual, calculated)]
return sum(errors) / len(actual)