Skip to content
C

Problem 4: Evaluate Regularized vs Unregularized Models on Test Data

Easypython

Problem Description

Write a Python program that trains both a standard Linear Regression model and a Ridge model on a training set, then compares their test set performance (using MSE) to see if regularization improved generalization.

Input

A dataset split into training and test sets.

Output

Test MSE for both the unregularized and regularized models.

Constraints

  • At least 10 data points.

Example Input

text
(A dataset with some noise, split into train/test)

Example Output

text
Linear Regression Test MSE: 15.2 Ridge Test MSE: 11.8

Concepts Covered

LinearRegression, Ridge, mean_squared_error(), generalization comparison.

Input (stdin)

Output

Run your code to see output here...