Chapter: Understanding Linear Regression Output
When beginners train a Linear Regression model, they often see many numbers in the output and don't know:
What is good?
What is bad?
What should I focus on?
Why are these metrics needed?
This chapter explains every important output in simple language.
1. Training Records
Example:
Training Records: 80
What is it?
Training records are the data used to teach the model.
Suppose you have:
100 products
You split them:
80 for training
20 for testing
Then:
Training Records = 80
Why do we need training data?
Imagine teaching a child.
You show:
Apple
Apple
Apple
Banana
Banana
Banana
After seeing many examples, the child learns the difference.
Machine Learning works the same way.
The model learns patterns from training data.
Example:
Higher Marketing Spend
→ Higher Sales
More Reviews
→ Higher Sales
The model learns these relationships.
Can we train on all data?
Yes.
But then we cannot check whether the model actually learned.
That's why we keep some data separate.
That separate data is called:
Testing Data
2. Testing Records
Example:
Testing Records: 20
What is it?
Testing data is unseen data.
The model never sees it during training.
Example
Dataset:
100 products
Split:
80 Training
20 Testing
The model learns from 80 products.
Then we ask:
Can you predict sales
for these 20 products
you have never seen?
This is the test.
Why is testing important?
Without testing:
Model may memorize data
instead of learning.
This problem is called:
Overfitting
3. R² Score (R-Squared)
This is the most famous metric in Linear Regression.
Example:
R² = 0.95
What does R² measure?
It measures:
How well the model explains the data.
Or:
How good the model is.
Range of R²
0 → Worst
1 → Perfect
Example
Suppose actual sales are:
10000
15000
20000
25000
Predicted sales:
10100
14900
20100
24800
Predictions are very close.
Then:
R² ≈ 0.99
Very good.
Interpretation Table
| R² Score | Meaning |
|---|---|
| 1.0 | Perfect |
| 0.95 | Excellent |
| 0.90 | Very Good |
| 0.80 | Good |
| 0.70 | Acceptable |
| Below 0.50 | Weak |
Real Meaning
If:
R² = 0.92
It means:
92% of the variation in sales
is explained by the model.
4. MAE (Mean Absolute Error)
Example:
MAE = 500
What is MAE?
MAE tells:
How wrong the model is on average.
Example
Actual Sales:
10000
20000
30000
Predicted Sales:
10500
19500
30200
Errors:
500
500
200
Average:
(500+500+200)/3
= 400
MAE:
400
Meaning
Your predictions are wrong by:
₹400
on average.
Why people like MAE
Because it is easy to understand.
Example:
MAE = 250
means:
Average mistake = ₹250
Simple.
5. MSE (Mean Squared Error)
Example:
MSE = 250000
What is MSE?
MSE also measures error.
But before averaging:
It squares every error.
Example
Errors:
100
200
1000
Square them:
10000
40000
1000000
Average:
350000
Why square?
To punish big mistakes.
Example
Two models:
Model A:
100
100
100
errors
Model B:
50
50
1000
errors
Average errors look similar.
But Model B made one huge mistake.
MSE punishes that huge mistake heavily.
6. RMSE (Root Mean Squared Error)
Example:
RMSE = 600
Problem with MSE
MSE values become huge.
Example:
250000
Hard to understand.
Solution
Take square root.
√250000
= 500
Now easy to understand.
Meaning
Predictions are off by ₹500
on average.
Why companies use RMSE
Because it uses original units.
Sales:
₹
RMSE:
₹
Easy to explain to managers.
7. Actual vs Predicted
Example:
Actual Predicted
10000 10200
15000 14900
20000 20100
Actual
Actual means:
Real value
Example:
Actual Sales
= ₹10000
Predicted
Predicted means:
Model's guess
Example:
Predicted Sales
= ₹10200
Difference
10200 - 10000
= 200
Error:
₹200
Why compare?
Because this shows:
How close the model
is to reality.
8. Coefficients
Example:
MarketingSpend : 1.8
WebsiteVisits : 2.1
DiscountPercent : 120
CustomerReviews : 95
These numbers are extremely important.
What is a coefficient?
A coefficient tells:
How much a feature affects
the prediction.
Example
MarketingSpend:
1.8
Meaning:
Spend ₹1 more
Sales increase ₹1.8
Website Visits
2.1
Meaning:
One extra website visit
increases sales by ₹2.1
Customer Reviews
95
Meaning:
One additional review
increases sales by ₹95
Why coefficients matter?
They help businesses understand:
What drives sales?
Example:
Reviews have huge impact
Marketing has medium impact
Discount has low impact
Now the company knows where to invest money.
9. Cross Validation Score
Example:
Scores:
0.91
0.93
0.92
0.94
0.90
Average:
0.92
What is Cross Validation?
Instead of testing once:
Train-Test Split
we test many times.
Example
100 records.
Split into:
5 groups
Train and test:
5 times
Each time:
Different test data
Why?
Because one test split may be lucky.
Cross Validation checks:
Can the model perform well
on many different datasets?
Meaning
If:
Cross Validation = 0.92
Then:
Model is reliable.
Final Summary
| Metric | Question It Answers |
|---|---|
| Training Records | What data was used to learn? |
| Testing Records | What data was used to evaluate? |
| R² | How good is the model? |
| MAE | On average, how much am I wrong? |
| MSE | How severely should big mistakes be punished? |
| RMSE | What is the practical prediction error? |
| Actual vs Predicted | How close are predictions to reality? |
| Coefficients | Which features influence the prediction most? |
| Cross Validation | Will the model work well on unseen data in the future? |
If you understand these 9 outputs deeply, you can read and explain the results of most beginner and intermediate Linear Regression projects with confidence.
| Metric | Meaning |
|---|---|
| Training Records | Data used to learn |
| Testing Records | Data used to evaluate |
| R² | Model quality |
| MAE | Average error |
| MSE | Squared error |
| RMSE | Real-world error |
| Cross Validation | Reliability of model |
Most important thing to remember
For Linear Regression projects, the outputs you should always analyze are:
R² Score → How good is the model?
MAE → Average error.
RMSE → Practical prediction error.
Coefficients → Which features affect the target most?
Actual vs Predicted → How close predictions are to reality.
Cross Validation Score → Can the model generalize to new data?
Linear Regression Assignments
- Train a Linear Regression model to predict Monthly Sales.
- Calculate the R² (R-Squared) score.
Interpretation:
R² = 1.0
Perfect prediction
R² = 0.90
90% variance explained
R² = 0
No predictive power
- Calculate MAE (Mean Absolute Error).
Meaning:
Average prediction error
Example:
MAE = 500
means predictions are off by ₹500 on average.
- Calculate MSE (Mean Squared Error).
- Calculate RMSE (Root Mean Squared Error).
- Print all Linear Regression coefficients.
- Interpret the coefficient of Website Visits.
Interpret Website Visits Coefficient
Suppose:
WebsiteVisits = 2.5
Meaning:
One additional website visit
increases expected sales by ₹2.5
- Interpret the coefficient of Discount Percentage.
Suppose:
DiscountPercent = 120
Meaning:
Increasing discount by 1%
increases expected sales by ₹120
- Interpret the coefficient of Customer Reviews.
Suppose:
CustomerReviews = 95
Meaning:
One additional positive review
increases expected sales by ₹95
- Predict sales for a new product.
- Compare actual sales and predicted sales.
- Find the most influential feature.
- Create a complete Product Sales Prediction System using Linear Regression.
the output section by section :
1. DATASET
Output:
==================================================
DATASET
==================================================
MarketingSpend WebsiteVisits DiscountPercent CustomerReviews MonthlySales
0 5000 1200 5 45 15000
1 5500 1250 5 48 15800
2 6000 1300 6 50 16500
...
Meaning
This is your training data.
Each row represents one product/business scenario.
Example:
MarketingSpend = 5000
WebsiteVisits = 1200
DiscountPercent = 5
CustomerReviews = 45
MonthlySales = 15000
Interpretation:
Company spent ₹5000 on marketing,
got 1200 website visits,
offered 5% discount,
received 45 reviews,
and generated ₹15000 sales.
2. Model Trained Successfully!
Output:
Model Trained Successfully!
Meaning
This line executes:
model.fit(X_train, y_train)
The model learns relationships like:
Higher marketing spend
→ Higher sales
More reviews
→ Higher sales
More visits
→ Higher sales
The model creates a mathematical equation.
3. MODEL EVALUATION
Example:
R² Score : 0.98
MAE : 450.25
MSE : 350000
RMSE : 591.60
4. R² Score
Example:
R² Score : 0.98
R² measures:
How well the model explains sales.
Range:
0 → Bad
1 → Perfect
Interpretation:
0.98 means
98% of sales variation
is explained by the model.
Very good model.
5. MAE (Mean Absolute Error)
Example:
MAE : 450
Formula:
Average of all prediction errors
Example:
Actual sales:
15000
20000
25000
Predicted:
14500
20500
25200
Errors:
500
500
200
MAE:
(500+500+200)/3
= 400
Meaning:
Model is wrong by ₹400 on average.
6. MSE (Mean Squared Error)
Example:
MSE : 350000
Formula:
Square every error
then average.
Why?
Because big mistakes should be punished more.
Example:
Errors:
100
100
1000
MSE becomes large because:
1000² = 1,000,000
Large errors affect MSE heavily.
7. RMSE
Example:
RMSE : 591.60
Formula:
RMSE = √MSE
Meaning:
Average prediction error
in sales units.
Interpretation:
Predictions are off by
approximately ₹592.
RMSE is usually easier to understand than MSE.
8. ACTUAL VS PREDICTED
Output:
Actual Sales Predicted Sales
15000 15250
18500 18100
25000 24850
Meaning
Actual:
Real sales value
Predicted:
Model's guess
Difference:
Prediction Error
Example:
Actual = 15000
Predicted = 15250
Error = 250
9. FEATURE COEFFICIENTS
Example:
MarketingSpend : 1.85
WebsiteVisits : 2.10
DiscountPercent : 115
CustomerReviews : 92
These are the most important outputs.
MarketingSpend Coefficient
1.85
Meaning:
For every ₹1 increase
in marketing spend,
sales increase by ₹1.85
assuming other variables remain unchanged.
WebsiteVisits Coefficient
2.10
Meaning:
One extra website visit
increases sales by ₹2.10
DiscountPercent Coefficient
115
Meaning:
Increasing discount
by 1%
increases sales
by ₹115
CustomerReviews Coefficient
92
Meaning:
One additional review
increases sales
by ₹92
10. Intercept
Example:
Intercept: 3500
The model equation becomes:
Sales
=
3500
+
(1.85 × MarketingSpend)
+
(2.10 × WebsiteVisits)
+
(115 × DiscountPercent)
+
(92 × CustomerReviews)
The intercept is the starting value when all inputs are zero.
11. NEW PRODUCT PREDICTION
Input:
new_product = [
15000,
2800,
20,
100
]
Meaning:
Marketing Spend = ₹15000
Website Visits = 2800
Discount = 20%
Reviews = 100
Output:
Predicted Monthly Sales:
34000
Meaning:
The model expects
₹34,000 sales
for this product.
12. CROSS VALIDATION
Example:
Individual Scores
0.97
0.98
0.96
0.99
0.98
Meaning
Dataset is divided into:
5 parts
Model trains:
5 times
Every time:
Different test data
is used.
This checks:
Can the model perform
well on unseen data?
13. Average Cross Validation Score
Example:
Average R² Score: 0.976
Meaning:
Average performance
across all 5 experiments.
Interpretation:
97.6%
Excellent model
14. FINAL REPORT
Example:
Algorithm Used : Linear Regression
Training Records : 16
Testing Records : 4
R² Score : 0.98
MAE : 450
MSE : 350000
RMSE : 591
Cross Val Mean : 0.976
Meaning
| Metric | Meaning |
|---|---|
| Training Records | Data used to learn |
| Testing Records | Data used to evaluate |
| R² | Model quality |
| MAE | Average error |
| MSE | Squared error |
| RMSE | Real-world error |
| Cross Validation | Reliability of model |
Most important thing to remember
For Linear Regression projects, the outputs you should always analyze are:
R² Score → How good is the model?
MAE → Average error.
RMSE → Practical prediction error.
Coefficients → Which features affect the target most?
Actual vs Predicted → How close predictions are to reality.
Cross Validation Score → Can the model generalize to new data?
For Logistic Regression,
these are the main evaluation tools you used:
1. Accuracy
What it checks?
Accuracy checks:
Out of all predictions, how many were correct?
Formula
[
Accuracy = \frac{Correct Predictions}{Total Predictions}
]
Example
Suppose:
Total Customers = 100
Correct Predictions = 95
Then:
Accuracy = 95/100 = 0.95 = 95%
Simple Meaning
The model gives correct answers 95 times out of 100.
2. Precision
What it checks?
Precision checks:
When the model says "Customer will purchase", how often is it correct?
Formula
[
Precision = \frac{TP}{TP + FP}
]
Example
Model predicted:
20 customers will purchase
Actually:
18 purchased
2 did not purchase
Then:
Precision = 18/20 = 90%
Simple Meaning
If the model predicts a purchase, how much can we trust that prediction?
3. Recall
What it checks?
Recall checks:
Out of all actual buyers, how many did the model find?
Formula
Recall = TP
_________
TP + FN
Example
Actual buyers:
30 customers
Model identified:
27 buyers
Then:
Recall = 27/30 = 90%
Simple Meaning
How good is the model at finding all customers who will purchase?
4. Confusion Matrix
What it checks?
It shows every prediction in a table.
Example:
Predicted
No Yes
Actual No 8 1
Actual Yes 2 9
True Positive (TP)
Model predicted:
Purchase
Customer actually:
Purchased
Correct positive prediction.
Example:
Predicted = 1
Actual = 1
True Negative (TN)
Model predicted:
No Purchase
Customer actually:
Did Not Purchase
Correct negative prediction.
Example:
Predicted = 0
Actual = 0
False Positive (FP)
Model predicted:
Purchase
Customer actually:
Did Not Purchase
Wrong prediction.
Example:
Predicted = 1
Actual = 0
Also called:
False Alarm
False Negative (FN)
Model predicted:
No Purchase
Customer actually:
Purchased
Wrong prediction.
Example:
Predicted = 0
Actual = 1
Visual Understanding
| Actual | Predicted | Type |
|---|---|---|
| 1 | 1 | TP |
| 0 | 0 | TN |
| 0 | 1 | FP |
| 1 | 0 | FN |
5. Coefficients
What do they check?
Coefficients tell:
Which feature affects the prediction and by how much.
Example:
Age = 0.10
Income = 0.0002
CartItems = 2.50
Interpretation
Positive coefficient:
Higher value
→ More chance of purchase
Negative coefficient:
Higher value
→ Less chance of purchase
6. Most Influential Feature
What does it check?
Find the feature with the largest coefficient.
Example:
Age = 0.10
Income = 0.0002
WebsiteVisits = 0.80
CartItems = 2.50
Largest coefficient:
CartItems = 2.50
Meaning
CartItems has the strongest impact on purchase prediction.
7. Prediction on New Customer
What does it check?
Tests the trained model on unseen data.
Example:
new_customer = [[30,45000,7,18,4]]
Output:
[1]
Meaning:
Customer is likely to purchase.
Easy Viva Summary
| Tool | Purpose |
|---|---|
| Accuracy | Overall correctness |
| Precision | How reliable positive predictions are |
| Recall | How many actual buyers are found |
| Confusion Matrix | Shows TP, TN, FP, FN |
| TP | Correctly predicted buyer |
| TN | Correctly predicted non-buyer |
| FP | Predicted buyer but didn't buy |
| FN | Predicted non-buyer but actually bought |
| Coefficients | Impact of each feature |
| Most Influential Feature | Strongest feature affecting prediction |
| New Prediction | Predicts outcome for new customer |
One-line memory trick
Confusion Matrix → "What mistakes did the model make?"
Accuracy → "How many predictions were correct?"
Precision → "Can I trust a positive prediction?"
Recall → "Did I find all the actual positives?"
Coefficients → "Which feature matters most?"
customer data
CustomerID,Age,MonthlyIncome,WebsiteVisits,TimeSpentMinutes,CartItems,Purchased
1,22,25000,2,5,0,0
2,24,28000,3,7,1,0
3,26,30000,5,12,2,1
4,28,35000,6,15,3,1
5,30,40000,2,4,0,0
6,32,45000,7,18,4,1
7,35,50000,8,20,5,1
8,21,22000,1,3,0,0
9,27,32000,4,10,1,0
10,29,38000,6,14,3,1
11,31,42000,7,17,4,1
12,23,26000,2,6,0,0
13,25,29000,3,8,1,0
14,34,48000,8,21,5,1
15,36,52000,9,24,6,1
16,20,21000,1,2,0,0
17,22,24000,2,5,0,0
18,24,27000,3,7,1,0
19,26,31000,5,11,2,1
20,28,36000,6,15,3,1
21,30,41000,7,18,4,1
22,32,46000,8,20,5,1
23,34,50000,9,22,5,1
24,21,23000,1,4,0,0
25,23,25000,2,5,0,0
26,25,28000,3,8,1,0
27,27,33000,4,11,2,1
28,29,37000,5,13,2,1
29,31,43000,7,17,4,1
30,33,47000,8,20,5,1
31,35,51000,9,23,6,1
32,20,20000,1,2,0,0
33,22,24000,2,4,0,0
34,24,27000,3,7,1,0
35,26,30000,4,10,2,1
36,28,35000,5,12,2,1
37,30,40000,6,15,3,1
38,32,45000,7,18,4,1
39,34,50000,8,21,5,1
40,36,55000,10,25,7,1
41,21,22000,1,3,0,0
42,23,26000,2,6,0,0
43,25,29000,3,8,1,0
44,27,34000,4,10,2,1
45,29,39000,5,13,3,1
46,31,43000,6,16,4,1
47,33,47000,8,20,5,1
48,35,52000,9,24,6,1
49,20,21000,1,2,0,0
50,22,25000,2,5,0,0
51,24,28000,3,7,1,0
52,26,32000,4,10,2,1
53,28,36000,5,12,2,1
54,30,41000,6,15,3,1
55,32,46000,7,18,4,1
56,34,50000,8,21,5,1
57,36,56000,10,26,7,1
58,21,23000,1,4,0,0
59,23,26000,2,5,0,0
60,25,30000,3,8,1,0
61,27,34000,4,11,2,1
62,29,39000,5,13,3,1
63,31,44000,7,17,4,1
64,33,48000,8,20,5,1
65,35,53000,9,24,6,1
66,20,20000,1,2,0,0
67,22,24000,2,4,0,0
68,24,27000,3,7,1,0
69,26,31000,4,10,2,1
70,28,35000,5,12,2,1
71,30,40000,6,15,3,1
72,32,45000,7,18,4,1
73,34,50000,8,21,5,1
74,36,55000,10,25,7,1
75,21,22000,1,3,0,0
76,23,25000,2,5,0,0
77,25,29000,3,8,1,0
78,27,33000,4,10,2,1
79,29,38000,5,13,3,1
80,31,42000,6,16,4,1
81,33,47000,8,20,5,1
82,35,52000,9,24,6,1
83,20,21000,1,2,0,0
84,22,24000,2,4,0,0
85,24,28000,3,7,1,0
86,26,32000,4,10,2,1
87,28,36000,5,12,2,1
88,30,41000,6,15,3,1
89,32,46000,7,18,4,1
90,34,50000,8,21,5,1
91,36,56000,10,26,7,1
92,21,23000,1,4,0,0
93,23,26000,2,5,0,0
94,25,30000,3,8,1,0
95,27,34000,4,11,2,1
96,29,39000,5,13,3,1
97,31,44000,7,17,4,1
98,33,48000,8,20,5,1
99,35,53000,9,24,6,1
100,37,58000,10,28,8,1
Dataset:
Customer Purchase Prediction Dataset
Target Column:
Purchased
0 = Customer did not purchase
1 = Customer purchased
Assignment 1
Load the Customer Purchase Prediction dataset and train a Logistic Regression model using all available input features to predict whether a customer will purchase a product.
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
# Load Dataset
df = pd.read_csv("customer_data.csv")
# Features
X = df[
[
"Age",
"MonthlyIncome",
"WebsiteVisits",
"TimeSpentMinutes",
"CartItems"
]
]
# Target
y = df["Purchased"]
# Split Dataset
X_train, X_test, y_train, y_test = train_test_split(
X,
y,
test_size=0.2,
random_state=42
)
# Create Model
model = LogisticRegression(max_iter=1000)
# Train Model
model.fit(X_train, y_train)
print("Model Trained Successfully")
Interpretation
The Logistic Regression model learns patterns from customer information to predict whether a customer will purchase a product.
Assignment 2
Use the trained Logistic Regression model to predict purchase decisions for all records in the test dataset.
y_pred = model.predict(X_test)
print(y_pred)
Assignment 3
Calculate the accuracy of the Logistic Regression model and explain what the accuracy value indicates about the model's performance.
from sklearn.metrics import accuracy_score
accuracy = accuracy_score(
y_test,
y_pred
)
print("Accuracy:", accuracy)
Formula
Accuracy = TP + TN
________________
TP + TN + FP + FN
Expected Result
Accuracy ≈ 1.0
Interpretation
The model correctly predicts nearly all customer purchase decisions.
If accuracy is 1.0:
The model correctly classified 100% of the customers in the test dataset.
Assignment 4
Calculate the precision score of the Logistic Regression model and explain its importance in customer purchase prediction.
from sklearn.metrics import precision_score
precision = precision_score(
y_test,
y_pred
)
print("Precision:", precision)Precision = TP
__________
TP + FP
Interpretation
When the model predicts that a customer will purchase, it is almost always correct.
Assignment 5
Calculate the recall score of the Logistic Regression model and explain its significance.
from sklearn.metrics import recall_score
recall = recall_score(
y_test,
y_pred
)
print("Recall:", recall)
Formula
TP
___________
TP + FN
Expected Result
Recall ≈ 1.0
Interpretation
The model successfully identifies almost all customers who actually purchase.
Assignment 7
Generate the confusion matrix for the Logistic Regression model and identify the values of True Positives, True Negatives, False Positives, and False Negatives.
from sklearn.metrics import confusion_matrix
cm = confusion_matrix(
y_test,
y_pred
)
print(cm)
Expected Output
[[8 0]
[0 12]]
Interpretation
TN = 8
FP = 0
FN = 0
TP = 12
True Negatives = 8
False Positives = 0
False Negatives = 0
True Positives = 12
The model makes no prediction errors.
Assignment 8
Display all coefficients learned by the Logistic Regression model and explain how each feature influences the purchasing decision.
for feature, coef in zip(
X.columns,
model.coef_[0]
):
print(feature, ":", coef)
print("Intercept:", model.intercept_[0])
Example Output
Age : 0.12
MonthlyIncome : 0.0003
WebsiteVisits : 0.85
TimeSpentMinutes : 0.90
CartItems : 2.45
Intercept : -12.34
Interpretation
Feature Meaning Age Higher age slightly increases purchase chance MonthlyIncome Higher income increases purchase chance WebsiteVisits More visits increase purchase chance TimeSpentMinutes More time spent increases purchase chance CartItems Strongly increases purchase chance
Positive coefficient:
Feature increases
→ Purchase probability increases
Negative coefficient:
Feature increases
→ Purchase probability decreases
Assignment 9
Identify the most influential feature in the Logistic Regression model and justify your answer using the coefficient values.
Example:
Age : 0.12
MonthlyIncome : 0.0003
WebsiteVisits : 0.85
TimeSpentMinutes : 0.90
CartItems : 2.45
Largest coefficient:
CartItems : 2.45
Interpretation
CartItems is the most influential feature because it has the highest coefficient value.
Customers with more items in their cart are much more likely to purchase.
Assignment 10
Create a new customer record and use the Logistic Regression model to predict whether the customer is likely to purchase the product.
new_customer = [[
30, # Age
45000, # MonthlyIncome
7, # WebsiteVisits
18, # TimeSpentMinutes
4 # CartItems
]]
prediction = model.predict(
new_customer
)
print(prediction)
Expected Output
[1]
Interpretation
1 = Customer likely to purchase
The model predicts that this customer will buy the product because they have:
Good income
Multiple website visits
High engagement time
Several items in the cart
Decision Tree
Assignment 11
Train a Decision Tree Classifier using the Customer Purchase Prediction dataset and evaluate its performance.
Assignment 12
Calculate the accuracy of the Decision Tree model and compare it with the accuracy of the Logistic Regression model.
Assignment 13
Generate a confusion matrix for the Decision Tree model and analyze the prediction errors.
Assignment 14
Train a Decision Tree model with a maximum depth of 2 and observe how limiting tree depth affects prediction accuracy.
Assignment 15
Train another Decision Tree model with a maximum depth of 5 and compare its performance with the previous model.
Assignment 16
Compare the performance of Decision Tree models trained with maximum depths of 2, 5, and unlimited depth.
Assignment 17
Determine the optimal tree depth that produces the best prediction performance for this dataset.
Assignment 18
Visualize the complete Decision Tree and explain the meaning of each decision node.
Assignment 19
Extract and display feature importance values from the Decision Tree model and identify the most important feature.
Assignment 20
Use the trained Decision Tree model to predict the purchasing behavior of a new customer.
0 Comments