Problem 4: Visualize the Regression Line
Easypython
Problem Description
Write a Python program that plots the original data points as a scatter plot, along with the fitted regression line, using Matplotlib.
Input
Training data (X, y).
Output
A displayed chart showing the data points and the fitted line.
Constraints
- At least 5 data points.
Example Input
textX = [[1],[2],[3],[4],[5]], y = [3,5,7,9,11]
Example Output
text(A scatter plot with a straight line fitted through the points)
Concepts Covered
plt.scatter(), plt.plot(), LinearRegression.