{ "cells": [ { "cell_type": "markdown", "id": "164d7e04", "metadata": {}, "source": [ "# Multi-Split Decision Tree Visualizer\n", "\n", "This notebook creates an interactive Gradio app to visualize how decision trees partition the feature space with **multiple splits** and shows the complete **decision tree structure**.\n", "\n", "## ✨ New Features:\n", "- **Multiple Partitions**: Add as many splits as you want to build a complete tree\n", "- **Decision Tree Visualization**: See the tree structure with all nodes and connections\n", "- **Interactive Split Entry**: Add splits in a simple text format (feature, threshold)\n", "- **Comprehensive Statistics**: Track entropy and Gini index for each node and leaf\n", "- **Color-coded Visualization**: \n", " - Blue arrows = \"Yes\" branch (≤ threshold)\n", " - Red arrows = \"No\" branch (> threshold)\n", " - Light blue leaves = Predicts Class 0 (Lemon)\n", " - Orange leaves = Predicts Class 1 (Orange)\n", "\n", "## 📊 Three-Panel Display:\n", "1. **Top-Left**: Partitioned feature space with all split boundaries\n", "2. **Bottom-Left**: Complete decision tree structure\n", "3. **Right**: Detailed statistics and impurity measures" ] }, { "cell_type": "code", "execution_count": 1, "id": "8b654a81", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "c:\\Users\\rinab\\miniforge3\\envs\\WORK\\lib\\site-packages\\tqdm\\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from .autonotebook import tqdm as notebook_tqdm\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "* Running on local URL: http://127.0.0.1:7860\n", "* Running on public URL: https://4d58db9d9d6f8c53bc.gradio.live\n", "\n", "This share link expires in 1 week. For free permanent hosting and GPU upgrades, run `gradio deploy` from the terminal in the working directory to deploy to Hugging Face Spaces (https://huggingface.co/spaces)\n", "* Running on public URL: https://4d58db9d9d6f8c53bc.gradio.live\n", "\n", "This share link expires in 1 week. For free permanent hosting and GPU upgrades, run `gradio deploy` from the terminal in the working directory to deploy to Hugging Face Spaces (https://huggingface.co/spaces)\n" ] }, { "data": { "text/html": [ "
" ], "text/plain": [ "