Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
st.set_page_config(page_title="Decision Tree", page_icon="✨", layout="wide")
|
| 4 |
+
|
| 5 |
+
st.markdown("<h1 style='color: #003366;'>Understanding Decision Tree</h1>", unsafe_allow_html=True)
|
| 6 |
+
st.image("https://cdn-uploads.huggingface.co/production/uploads/673f6e448c5214b832b3724c/zcCYCBE0x2U-nrPU5hBqc.png")
|
| 7 |
+
|
| 8 |
+
# Introduction
|
| 9 |
+
st.write("""
|
| 10 |
+
- A Decision Tree is a popular and powerful supervised machine learning algorithm used for both classification and regression tasks.
|
| 11 |
+
- It models decisions and their possible consequences as a tree-like structure, similar to a flowchart.
|
| 12 |
+
- In a decision tree, data is split into smaller subsets based on certain conditions (called features), and this process continues recursively, forming a tree with nodes (where decisions are made) and leaves (which represent the final output or decision).
|
| 13 |
+
""")
|
| 14 |
+
st.markdown("<h2 style='color: #003366;'>How Decision Tree Works</h2>", unsafe_allow_html=True)
|
| 15 |
+
|
| 16 |
+
st.subheader("Training Phase")
|
| 17 |
+
st.write("""
|
| 18 |
+
- Training a decision tree involves building the tree structure by splitting the dataset into subsets based on feature values, with the goal of minimizing uncertainty or impurity at each step.
|
| 19 |
+
- Start at the root node with the full training dataset.
|
| 20 |
+
- Choose the best feature to split the data. This is done using a criterion like:
|
| 21 |
+
- Gini Impurity (used in classification)
|
| 22 |
+
- Entropy / Information Gain (used in classification)
|
| 23 |
+
- Mean Squared Error (MSE) (used in regression)
|
| 24 |
+
- Split the dataset based on the selected feature's values.
|
| 25 |
+
- Repeat the process recursively for each child node, until:
|
| 26 |
+
- A stopping condition is met (like max depth or minimum samples per leaf), or The node is pure (all data points have the same label).
|
| 27 |
+
""")
|
| 28 |
+
|
| 29 |
+
|