Skip to content
CampusEduX

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

text
actual=[10,20,30], predicted=[12,18,33]

Example Output

text
MAE: 2.33 MSE: 5.67

Concepts Covered

Loops, absolute value, manual formula implementation.

Related Problems

  • Problem 1: Calculate All Four Regression Metrics
    Easy · python
    Solve Problem
  • Problem 3: Compare MAE and RMSE with an Outlier
    Easy · python
    Solve Problem
  • Problem 4: Calculate R² for a Trained Regression Model
    Easy · python
    Solve Problem

Input (stdin)

Output

Run your code to see output here...