Very Simple Linear Regression Programs to predict the Study Hours vs Marks Prediction
Step 1: Import Required Libraries
👉 Libraries are ready-made tools
Explain:
-
pandas→ handles data -
matplotlib→ shows graph -
LinearRegression→ regression model
Step 2: Create Data
👉 This is our learning data
Explain:
-
Hours → Input (X)
-
Marks → Output (Y)
Step 3: Separate Input and Output
Explain:
-
Machine learns X → Y relation
Step 4: Train the Regression Model
Explain:
-
fit()→ Machine learns pattern
Step 5: Predict Marks
Explain:
-
If student studies 6 hours, marks are predicted
Step 6: Show Graph
Explain:
-
Dots → Actual data
-
Line → Prediction line

No comments:
Post a Comment