numpy
numpy
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
Output:
yaml
Copy code
Slope (Coefficient): 2.0
Intercept: 0.0
Predicted Score for 6 Hours of Study: 12.0
Explanation:
This example trains a simple linear regression model to predict exam
scores based on study hours.
The graph shows the data points and the fitted regression line.
The slope (2.0) indicates that for each additional hour studied, the score
increases by 2.