Lab Assignment-8

 

Assignment-8- week 2 September

Learning Objective: Learn Decision Trees

Problem Statement

1.A college wants to predict whether a student will Pass or Fail in an examination based on three categorical attributes:

  • Attendance – High / Low
  • Study – Good / Poor
  • Previous Result – Pass / Fail

The following training dataset is available:

Student    Attendance    StudyPrevious Result    Final Result
S1HighGoodPassPass
S2HighGoodFailPass
S3HighPoorPassPass
S4HighPoorFailFail
S5LowGoodPassPass
S6LowGoodFailFail
S7LowPoorPassFail
S8LowPoorFailFail
S9HighGoodPassPass
S10LowGoodPassPass
S11HighPoorPassPass
S12LowPoorFailFail

Tasks

  1. Calculate the entropy of the complete dataset with respect to the Final Result.
  2. Calculate the Information Gain for each attribute:
    • Attendance
    • Study
    • Previous Result
  3. Select the attribute having the highest Information Gain as the root node.
  4. Repeat the entropy and Information Gain calculations for the remaining subsets.
  5. Construct the complete decision tree using the ID3 algorithm.
  6. Represent the final decision tree graphically.
  7. Use the constructed tree to predict the result for the following new students:
StudentAttendanceStudyPrevious Result
AHighPoorFail
BLowGoodPass
CLowPoorPass
DHighGoodFail

  1. Implement the same problem using Scikit-learn's decision tree classifier and compare the predictions with your manually constructed ID3 tree.


2.Implement a Decision Tree classifier using the ID3 algorithm to segment customers based on their purchasing behavior using the Online Retail dataset. Analyze the tree structure and discuss the feature importance.

Tasks:

  • Load and preprocess the Online Retail dataset.
  • Implement Decision Tree using the ID3 algorithm.
  • Visualize the decision tree and analyze feature importance.
  • Discuss how the tree structure helps in understanding customer behavior.


3.Implement and compare Logistic Regression and Decision Trees on the Adult Income dataset for predicting income levels. Evaluate both models based on performance metrics and interpretability.

Tasks:

  • Load and preprocess the Adult Income dataset.
  • Implement both Logistic Regression and Decision Trees.
  • Compare the models based on metrics such as accuracy, precision, recall, and F1-score.
  • Discuss the interpretability of both models and their suitability for the dataset.

Comments

Popular posts from this blog

Machine Learning Lab PCCSL508 Semester 5 KTU CS 2024 Scheme manual - Dr Binu V P

Lab Assignment-2

Lab Assignment-1