Problem 1: Fit a Simple Linear Regression Model
Easypython
Problem Description
Write a Python program that fits a Linear Regression model to a small dataset relating hours studied to exam scores, then prints the learned slope and intercept.
Input
A list of study hours and corresponding exam scores.
Output
The learned slope and intercept.
Constraints
- At least 5 data points.
Example Input
texthours = [1,2,3,4,5], scores = [45,55,65,75,85]
Example Output
textSlope: 10.0 Intercept: 35.0
Concepts Covered
LinearRegression, .fit(), .coef_, .intercept_.