Skip to content
C

Problem 1: Calculate All Four Regression Metrics

Easypython

Problem Description

Write a Python program that calculates MAE, MSE, RMSE, and R² for a set of actual and predicted values using Scikit-learn.

Input

Two lists: actual values and predicted values.

Output

All four calculated metrics.

Constraints

  • Both lists must have the same length.

Example Input

text
actual=[100,150,200,250], predicted=[110,140,210,240]

Example Output

text
MAE: 10.0 MSE: 100.0 RMSE: 10.0 R² Score: 0.98...

Concepts Covered

mean_absolute_error(), mean_squared_error(), r2_score(), np.sqrt().

Input (stdin)

Output

Run your code to see output here...