Glass Classification using Machine Learning

Madhu Kiran
3 min readOct 13, 2019

--

We are using Classification techniques like ID3,CART, Logistic Regression, Random Forest,Neural networks to classify the different types of glass.

Modules involved:

  1. Loading Data , pre-processing our data
  2. Splitting the data into training samples and testing samples
  3. Using classification techniques and finding the accuracy of the model
  4. Analyzing different classification metrics like MSE, RMSE , Precision , Recall , Accuracy etc.
  5. Concluding the best model.

DATASET

Details

Dimensions: 214 rows x 10 columns

Attribute Information:

  1. Id number: 1 to 214 (removed from CSV file)
  2. RI: refractive index
  3. Na: Sodium (unit measurement: weight percent in corresponding oxide, as are attributes 4–10)
  4. Mg: Magnesium
  5. Al: Aluminum
  6. Si: Silicon
  7. K: Potassium
  8. Ca: Calcium
  9. Ba: Barium
  10. Fe: Iron
  11. Type of glass: (class attribute) — 1 building_windows_float_processed — 2 building_windows_non_float_processed — 3 vehicle_windows_float_processed — 4 vehicle_windows_non_float_processed (none in this database) — 5 containers — 6 tableware — 7 headlamps

Our target attribute is “Type”, we need to classify the glass in 7 types as mentioned above based on the features.

1.Loading & pre-processing our dataset

Loading the dataset using pandas
preview of our dataset
Considering our target attribute as “Type”

As all the values are numeric, we can proceed to normalize the values

2.Splitting the data into training samples and testing samples

Divided the given dataset into train and test data with a 7:3 ratio using Sklearn’s train_test_split function.

3.Using classification techniques and finding the accuracy of the model

ID3

CART

Logistic Regression

Random Forest

Neural Network

4. Analyzing different classification metrics like MSE, RMSE , Precision , Recall , Accuracy etc.

we already analyzed them in the previous steps.

5. Concluding the best model.

CART
RANDOM FOREST
ID3
LOGISTIC REGRESSION

Among all the classifiers we choose CART as it has the highest accuracy later we choose Random forest and ID3 decision tree.

--

--

Responses (1)