Decision Tree Implementation on Iris Dataset
├── Introduction
│   └── Overview of Decision Tree Algorithm
├── Setting Up the Environment
│   ├── Importing Libraries
│   └── Loading the Dataset
├── Implementing the Decision Tree
│   ├── Data Preparation
│   ├── Model Training
│   └── Model Evaluation
├── Visualization
│   └── Decision Tree Visualization
└── Conclusion
    └── Insights and Observations

1. Introduction

Overview of Decision Tree Algorithm

2. Setting Up the Environment

Importing Libraries

import numpy as np
from sklearn.tree import Decision TreeClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report, confusion_matrix
from sklearn.datasets import load_iris
import matplotlib.pyplot as plt
from sklearn import tree

Loading the Dataset

iris = load_iris()
X = iris.data
y = iris.targe

3. Implementing the Decision Tree

Data Preparation

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42)

Model Training

model = DecisionTreeClassifier()
model.fit(X_train, y_train)

Model Evaluation

y_pred = model.predict(X_test)
conf_matrix = confusion_matrix(y_test, y_pred)
class_report = classification_report(y_test, y_pred)

4. Visualization

Decision Tree Visualization