Classification is a supervised machine learning method where the model tries to predict the correct label of a given input data. One of the algorithms used for classification is the “Random Forest Classifier”.
Here, we use the glass.csv dataset for classification purposes and you can download the dataset from the link on top of this page. This dataset has 9 features:
“RI”, “Na”, “Mg”, “Al”, “Si”, “K”, “Ca”, “Ba” and “Fe”
And the label for each item in the dataset is the type of Glass, which has 6 values:
“Building Windows Float Processed”, “Building Windows Non-Float Processed”, “Vehicle Windows Float Processed”, “Containers”, “Tableware” and “Headlamps”.
In the above form, you enter the values of 9 features, mostly chemical elements amount, and the model returns the type of glass in a pop-up form. The Random Forest Classifier takes more time than other models for calculation and you need to wait more to see the results in pop-up form.
Notice that the values and ranges of each feature are as below:
1.51 < RI: Refractive Index < 1.53
10.73 < Na: Sodium < 17.38
0 < Mg: Magnesium < 4.49
0.29 < Al: Aluminum < 3.5
69.81 < Si: Silicon < 75.41
0 < K: Potassium < 6.21
5.43 < Ca: Calcium < 16.19
0 < Ba: Barium < 3.15
0 < Fe: Iron < 0.51
The sample code used to train a “Random Forest” classification model, is provided in the link on top of this page. Each time you run this form and classification predictions happen, the values will store in the database, and with the link “result” on top of this page, you will see the previous results of the model prediction. Your recent run will be added to the end of this list.