Member-only story

Random Forest Classifier in Python

Step-by-step follow-along | Data Series | Episode 11.4

Mazen Ahmed
3 min readApr 10, 2022

An explanation of Random Forest Classifier: Episode 11.3

You can view and use the code and data in this episode here: Link

Objective

Produce a random forest classifier that predict the classes of rice.

Dataset Description

The dataset consists of two classes:

1: Jasmine Rice
0: Gonen Rice

Libraries

The libraries we use in this example are:

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import warnings

warnings.filterwarnings("ignore")

Importing and Exploring the Data

df = pd.read_csv("D:\ProjectData\\rice_dataset.csv")

# display first few rows of data
df.head()

We can remove the id column using the following code:

df.drop(["id"],1, inplace = True)

--

--

Mazen Ahmed
Mazen Ahmed

No responses yet