Decision Tree and Random Forest

Posted:   February 21, 2023

Status:   Completed

Categories :   Data

Were equations, pictures or diagrams not properly rendered, please refresh the page. If the problem persists, you can contact me.

Decision-Tree-Random-Forest-Classification

A decision tree is a supervised machine learning algorithm that can be used for both classification and regression problems. It is simply a series of sequential decisions made to reach a specific result.

But often, a single tree is not sufficient for producing effective results. Random Forest is a tree-based machine learning algorithm that leverages the power of multiple decision trees for making decisions.

Dataset

The dataset consists of 400 rows and 3 features, including Age, EstimatedSalary, and Purchased. Here, the target variable is Purchased, which indicates whether a person purchased the item or not.

Dataset Sample

|Age|EstimatedSalary|Purchased| |—|—————|———| |19|19000|0| |35|20000|0| |32|150000|1|

Visualization and Accuracy

Decision Tree

Training Set

image

Test Set

image

Accuracy: 0.91

Random Forest

Training Set

image

Test Set

image

Accuracy: 0.91

Comments


😅 Commenting is disabled on this post.
You can use extended GitHub flavored markdown in your comment. Commenting FAQs & Guidelines