An interactive educational web application that makes machine learning decision trees easy to understand for everyone! Learn through animations, step-by-step visualizations, hands-on experimentation, and quizzes - designed specifically for beginners .
- Animated Step-by-Step Tutorial: Learn decision tree basics with real-world examples
- Visual Explanations: Understand Gini vs Entropy with interactive comparisons
- Real-World Context: See how decision trees solve actual problems
-
Dataset Selection:
- 6 built-in datasets (Moons, Circles, Iris, Wine, Breast Cancer, Digits)
- Upload your own CSV file
- "What do these terms mean?" guide for every concept
- Clear dataset information with sample counts and feature descriptions
-
Hyperparameter Controls:
- Tree Depth: How many questions to ask
- Splitting Rules: When to split data (hover tooltips explain everything)
- Leaf Size: Minimum group size
- Decision Method: Choose how to organize data
-
Step-by-Step Tree Visualization:
- Watch your tree grow one level at a time
- AI narrator explains each decision in plain English
- Click nodes to see detailed explanations
-
Decision Boundary: 2D visualization showing how the tree makes decisions
-
Metrics Dashboard (Know if your model is good or bad!):
- FastAPI: Python web framework
- scikit-learn: Machine learning library for decision trees
- NumPy/Pandas: Data manipulation and processing
- Uvicorn: ASGI server for production deployment
- React 18 with TypeScript: Modern, type-safe UI
- Vite 5: Lightning-fast build tool
- TailwindCSS 3: Utility-first styling
- Zustand: Lightweight state management
- Framer Motion: Smooth animations
- D3.js v7: Interactive tree visualization
- Recharts: Charts and graphs for metrics
- Lucide React: Beautiful icon library
- Web Speech API: AI narration for tree explanations
- Python 3.8+
- Node.js 16+
- npm or yarn
Windows (PowerShell):
.\start.ps1Linux/Mac:
./start.shThese scripts will automatically:
- Set up Python virtual environment
- Install backend dependencies
- Install frontend dependencies
- Start both servers concurrently
Backend:
cd backend
pip install -r requirements.txt
python -m uvicorn main:app --reload --host 0.0.0.0 --port 8000Backend runs on http://localhost:8000
Frontend:
cd frontend
npm install
npm run devFrontend runs on http://localhost:3000
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/datasets |
List all available datasets |
| POST | /api/train |
Train decision tree model with hyperparameters |
| GET | /api/tree-structure |
Get hierarchical tree structure for visualization |
| GET | /api/metrics |
Get model performance metrics and confusion matrix |
| POST | /api/predict |
Make prediction with decision path trace |
| GET | /api/decision-boundary |
Get 2D decision boundary data |
| POST | /api/upload-dataset |
Upload custom CSV dataset |
| GET | /api/animated-tree |
Get step-by-step tree growth data |
ml-decision-tree-app/
βββ backend/
β βββ main.py # FastAPI application with all endpoints
β βββ ml_service.py # ML service with scikit-learn integration
β βββ tree_builder.py # Animated tree growth logic
β βββ requirements.txt # Python dependencies
β
βββ frontend/
β βββ src/
β β βββ pages/
β β β βββ IntroductionFinal.tsx # Animated learning page
β β β βββ PlaygroundRestructured.tsx # Main interactive playground
β β β βββ QuizNew.tsx # Quiz page
β β β
β β βββ components/
β β β βββ Navigation.tsx # Top navigation bar
β β β βββ introduction/
β β β β βββ AnimatedTreeBuilder.tsx # Animated tree demo
β β β β βββ BasicConcepts.tsx # Concept explanations
β β β β βββ GiniEntropyComparison.tsx # Gini vs Entropy
β β β βββ playground/
β β β βββ InteractiveTreeVisualizer.tsx # Step-by-step tree
β β β βββ DecisionBoundary.tsx # 2D boundary plot
β β β βββ MetricsDashboard.tsx # Metrics display
β β β
β β βββ store/
β β β βββ useStore.ts # Zustand state management
β β β
β β βββ services/
β β β βββ api.ts # API client
β β β
β β βββ App.tsx # Main app component
β β βββ main.tsx # Entry point
β β βββ index.css # Global styles
β β
β βββ index.html
β βββ package.json
β βββ vite.config.ts
β βββ tailwind.config.js
β βββ tsconfig.json
β
βββ start.ps1 # Windows start script
βββ start.sh # Linux/Mac start script
βββ LICENSE # MIT License
βββ README.md # This file
-
Introduction Page:
- Start here! Learn what decision trees are with animated examples
- No prior knowledge needed - everything is explained clearly
- See real-world applications
-
Playground:
- Choose a dataset or upload your own CSV file
- Click "What do these terms mean?" to understand dataset info
- Adjust settings (click the Settings Guide if unsure)
- Click "Train Decision Tree" and watch it grow step-by-step
- Listen to AI narrator explain each decision
- Check metrics to see if your model is good or needs improvement
-
Quiz: Test your understanding with interactive questions
Option : Docker
- Backend: Dockerfile for FastAPI + Uvicorn
- Frontend: Nginx to serve static files
- Use Docker Compose for orchestration
Contributions are welcome! This project aims to make ML education accessible to everyone.
How to Contribute:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - Free to use for educational and commercial purposes.





