Problem 3: Evaluate Model Fit with R² Score
Easypython
Problem Description
Write a Python program that trains a Linear Regression model, makes predictions on the training data, and calculates the R² score to evaluate how well the line fits.
Input
Training data (X, y).
Output
The R² score.
Constraints
- At least 5 data points.
Example Input
textX = [[1],[2],[3],[4],[5]], y = [2,4,5,4,5]
Example Output
textR² Score: 0.6
Concepts Covered
r2_score().