564 MB
942 files
Updated 3 months ago
Ctrl+K
| Name | Size | Uploaded | Xet hash |
|---|---|---|---|
| codes | 9 items | ||
| csv | 1 items | ||
| description | 3 items | ||
| report | 3 items | ||
| .DS_Store | 8.2 kB xet | 7b2d5740 | |
| README.md | 3.78 kB xet | 089dcf89 |
Decision_Trees_Clustering_and_Classification_HW4
Machine Learning Homework 4
Decision Trees, Clustering, and Classification
Course: Machine Learning
University: University of Tehran
Department: Electrical and Computer Engineering
Professor: [Insert Professorβs Name]
Semester: Fall 1403
Overview
This assignment focuses on decision tree classifiers, clustering methods, and spam classification . You will:
- Implement a Decision Tree classifier for spam email classification.
- Explore the Bias-Variance tradeoff in tree-based models.
- Analyze clustering techniques , including DBSCAN and OPTICS .
- Implement K-Means clustering for customer segmentation.
Assignment Structure
The homework consists of five main questions , covering both theoretical and practical aspects.
π Question 1: Decision Tree for Spam Classification (20 points)
- Implement a Decision Tree classifier using Information Gain .
- Train the model on email data to classify emails as spam or ham .
- Use 3-level depth pruning to improve generalization.
- Apply the trained model on a test dataset and predict email categories.
π Question 2: Bias-Variance Tradeoff in Decision Trees (20 points)
- Compare Decision Trees and Bagging Methods .
- Discuss bias and variance tradeoffs in different learning algorithms.
- Analyze how model complexity affects overfitting and underfitting .
π Question 3: Clustering Methods β Density-Based Models (20 points)
- Understand the role of clustering in unsupervised learning.
- Investigate density-based clustering using DBSCAN .
- Compare DBSCAN vs. OPTICS for identifying non-linearly separable clusters.
π Question 4: Decision Tree for Restaurant Wait Time Prediction (25 points)
- Train a decision tree model to predict if a customer will wait at a restaurant.
- Use entropy and Gini impurity for splitting.
- Implement the tree with and without pre-built libraries .
- Compare results using different feature selection techniques.
π Question 5: K-Means Clustering for Customer Segmentation (25 points)
- Perform K-Means clustering on customer transaction data.
- Analyze clusters based on:
- Annual income
- Spending score
- Gender & age distribution
- Determine the optimal number of clusters using elbow method .
- Visualize clusters in 2D and 3D plots .
Implementation Details
π Folder Structure
ML_HW4/
βββ data/ # Dataset files
βββ models/ # Trained models
βββ notebooks/ # Jupyter notebooks
βββ src/ # Python scripts
β βββ decision_tree.py # Decision Tree implementation
β βββ clustering.py # DBSCAN, OPTICS, K-Means
β βββ preprocessing.py # Data preprocessing functions
βββ results/ # Visualizations and reports
βββ requirements.txt # Dependencies
βββ README.md # This README file
How to Run the Code
- Clone the repository
git clone https://github.com/your-repository/ml_hw4.git cd ml_hw4 - Install dependencies
pip install -r requirements.txt - Run Decision Tree for Spam Classification
python src/decision_tree.py - Run Clustering Algorithms
python src/clustering.py - Open Jupyter Notebook for Analysis
jupyter notebook
- Total size
- 564 MB
- Files
- 942
- Last updated
- Sep 12
- Pre-warmed CDN
- US EU US EU