Problem 2: Manually Calculate MAE and MSE
Easypython
Learn the Concept: Regression Metrics (MAE, MSE, RMSE, R²)Problem Description
Write a Python program that manually calculates MAE and MSE for a set of actual and predicted values, without using any built-in metric functions.
Input
Two lists: actual values and predicted values.
Output
The manually calculated MAE and MSE.
Constraints
- Both lists must have the same length.
Example Input
textactual=[10,20,30], predicted=[12,18,33]
Example Output
textMAE: 2.33 MSE: 5.67
Concepts Covered
Loops, absolute value, manual formula implementation.
Related Problems
- Problem 1: Calculate All Four Regression MetricsEasy · pythonSolve Problem
- Problem 3: Compare MAE and RMSE with an OutlierEasy · pythonSolve Problem
- Problem 4: Calculate R² for a Trained Regression ModelEasy · pythonSolve Problem