The aim is to classify five types of alcohols (1-Octanol, 1-Propanol, 2-Butanol, 2-Propanol, 1-Isobutanol) from the QCM sensor data.
A QCM is an electromechanical oscillator that contains a thin slice of quartz crystal with two channels placed on its surface. This physical device is sensitive to the resonance frequency.
The central goal here is to design an electronic nose model that makes proper classifications for the different alcohol types.
Electronic noses are sensors designed to mimic humans' sensory abilities to detect complex mixtures of chemical substances and biological origin.
This is a classification project, since the variable to be predicted is categorical (1-Octanol, 1-Propanol, 2-Butanol, 2-Propanol, 1-Isobutanol).
The first step is to prepare the data set, which is the source of information for the classification problem. For that, we need to configure the following concepts:
The variables are:
The input variables are the five first variables. They are the five different concentrations through which each of the different alcohols is passed through the sensor.
Note that neural networks work with numbers. In this regard, the categorical variable "class" is transformed into three numerical variables as follows:
The instances are divided into training, selection, and testing subsets. They represent 60% (15), 0% (0), and 20% (25) of the original instances, respectively, and are split at random.
We can calculate the distributions of all variables. The next figure is the pie chart for the alcohols types.
As we can see, the target is well-distributed since there is the same number for the five different alcohols types.
Finally, the inputs-targets correlations might indicate to us what factors most influence.
As we can see, the variables are strongly correlated.
The second step is to choose a neural network. For classification problems, it is usually composed by:
The scaling layer contains the statistics on the inputs calculated from the data file and the method for scaling the input variables. Here the minimum and maximum method has been set. Nevertheless, the mean and standard deviation method would produce very similar results.
In our case there is no a perceptron layer. This is due to having little data, so we simplify the program.
The neural network has five outputs since the target variable contains 5 classes (1-Octanol, 1-Propanol, 2-Butanol, 2-Propanol, 1-Isobutanol).
The fourth step is to set the training strategy, which is composed of:
The following chart shows how the training and selection errors decrease with the epochs during the training process.
The final value are training error = 0.109 NSE, and the selection error doesn't appear because the instances are divided into training and testing subsets.
Order selection algorithms train several network architectures with a different number of neurons and select that with the smallest selection error.
The incremental order method starts with a small number of neurons and increases the complexity at each iteration.
The purpose of the testing analysis is to validate the generalization performance of the model. Here we compare the neural network outputs to the corresponding targets in the testing instances of the data set.
In the confusion matrix, the rows represent the targets (or real values) and the columns the corresponding outputs (or predictive values). The diagonal cells show the correctly classified cases, and the off-diagonal cells show the misclassified cases.
|Predicted 1-Octanol||Predicted 1-Propanol||Predicted 2-Butanol||Predicted 2-Propanol||Predicted 1-Isobutanol|
|Real 1-Octanol||1 (10.0%)||0||0||0||0|
|Real 1-Propanol||0||3 (30.0%)||0||0||0|
|Real 2-Butanol||0||0||3 (30.0%)||0||0|
|Real 2-Propanol||0||0||0||1 (10.0%)||0|
|Real 1-Isobutanol||0||0||0||0||2 (20.0%)|
As we can see, the number of instances that the model can correctly predict is 10 (100%), so there are no misclassified cases. This shows that our predictive model has an excellent classification accuracy.
The neural network is now ready to predict outputs for inputs that it has never seen. This process is called model deployment.
To classify a given alcohol, we calculate the neural network outputs from the frequencies corresponding to the different types of concentration. For instance:
For this particular case, our e-nose developed would classify the alcohol as 1-Isobutanol, since it has the highest probability.
The mathematical expression of the trained neural network is listed below.
We have developed an e-nose algorithm that can be implemented in sensors, like QCM sensors, to detect the corresponding type of alcohol.