Skip to content

Implement a basic Decision Tree from scratch in Python.

Notifications You must be signed in to change notification settings

KartikAg13/banknote_auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Decision Tree from Scratch

This project implements a Decision Tree Classifier from scratch using only NumPy, Pandas, and Matplotlib, without using Scikit-Learn. The dataset used is the Banknote Authentication Dataset from Kaggle.

📌 Features

  • Pure NumPy Implementation (No Scikit-Learn)
  • Custom Gini Impurity Calculation
  • Manual Data Shuffling & Splitting
  • Recursively Built Decision Tree
  • Performance Evaluation (Accuracy Calculation)

📂 Dataset

The dataset contains 4 numerical features extracted from banknotes:

  • Variance of Wavelet Transformed Image
  • Skewness of Wavelet Transformed Image
  • Curtosis of Wavelet Transformed Image
  • Entropy of Image

The target column:

  • Class (0: Fake Note, 1: Authentic Note)

🔧 Installation

Clone this repository and install dependencies:

https://github.com/KartikAg13/banknote_auth.git
cd banknote_auth
pip install pandas numpy matplotlib

🏗️ Project Structure

├── main.ipynb  # Jupyter Notebook with implementation
├── README.md   # Project Documentation

📊 Results

  • Accuracy: ~90% on test data
  • Max Depth: Configurable (default: 3)
  • Visualization: Scatter plot of feature distribution

✨ Next Steps

  • Implement pruning to prevent overfitting.
  • Support entropy as an alternative impurity measure.
  • Convert the code into a class-based implementation.

👨‍💻 Developed by: Kartik Agrawal

About

Implement a basic Decision Tree from scratch in Python.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published