Coding Random forest classifier using sklearn
The dataset that we are going to use is the Fashion MNIST dataset. You can download this data from Kaggle.
The dataset contains 10 labels. Some of the labels are
0 T-shirt/top
1 Trouser
2 Pullover
3 Dress
4 Coat
5 Sandal
6 Shirt
7 Sneaker
8 Bag
9 Ankle boot
Step 1- Import all the required libraries.
Step 2- Load the training and test dataset using the pandas library and then shuffle the training data.
Step 3- Take a look at our data using the matplotlib library.
Step 4- Visualize the 10 classes using the TSNE algorithm. TSNE stands for t-distributed stochastic neighbor embedding. It is used to preserve points within the clusters.
Step 5- Split the dataset into training and testing and then normalize it
Step 6- Apply Random forest classifier
Step 7- Test the classifier on testing data and then calculate accuracy
Comments