Bulletin of Electrical Engineering and Informatics

Received Feb 8, 2023 Revised Apr 24, 2023 Accepted May 4, 2023 Due to the disturbingly high quantities of pesticides found in recent years, it has become essential to analyze the food composition intended for consumption. In this study and from a similar angle, we are interested in the detection of alpha-cypermethrin insecticide residues in edible Swiss chard. To this end, we suggest an electronic nose that was constructed using metal oxide gas sensors. Following data collection and pre-processing, two machine learning algorithms—principal component analysis (PCA) and support vector machine (SVM)—were used to analyze the sensor matrix data. The PCA method initially showed that the first three principal components (PCs) may account for more than 96.5% of the sample variation with a clear distinction between known groups corresponding to treated and untreated samples. The identification of untreated Swiss chard from treated one was then accomplished using the SVM method with five folds cross-validation, with a success rate of 92.3%. These results show that our suggestion, which is quick, easy, and affordable, can be utilized as an effective substitute for current methods for identifying Swiss chard that has been treated with the hazardous alpha-cypermethrin.


INTRODUCTION
Vegetables and fruits are the foundation of a balanced and nutritious diet, and man has relied on them for nutrition since earlier times.However, modern man has endangered his health by relying on new ways to protect his crops from harm, disease, and insects by using hazardous substances as pesticides, and their presence on agricultural products is linked to a number of health issues, such as cancer and hormonal disorders [1].Because of its availability and low cost, the Swiss chard (Beta vulgaris L.), a Chenopodiaceae glycophytic [2], is utilized as a leafy green vegetable.Wild Swiss chard is a salty plant that, because of its nutrient-dense and mineral-rich composition, is a staple in the cuisine of the people of the Mediterranean countries.It is frequently used in meals in the traditional manner in two situations: salads, either raw or cooked, like spinach.Additionally, it is a well-liked treatment for a variety of ailments like kidney and liver conditions as well as activation of the immune and hematopoietic systems [3].
This juicy and tender plant is susceptible to damage by many insects such as aphids, this bug sucks Swiss chard's fluids from the top stems and leaves [4].To put an end to the problems of Swiss chard exposure to insects, insecticides are used.We found that among the commonly used insecticides, alpha-cypermethrin is a very effective pyrethroid insecticide made up of two of the most lethal isomers of cypermethrin [5].As a broad-spectrum pesticide, it protects against a variety of pests that can harm fruits, grains, and other crops.

3375
What if physicochemical means were used and are still used in our time to detect pesticide residues in agricultural products, such as gas chromatography [6], which is used alone or in combination with other tools, such as mass spectrometry [7] or infrared spectroscopy [8].Then another electronic device known to be widely also used in this field because of the time and effort it saves, this device is nothing but the electronic nose [9], as it has been used to detect pesticide residues in mint [10]- [12], tea [13], tomatoes [14], potatoes [15], [16], and other vegetables and fruits [17].
In this investigation, a laboratory-created electronic nose will be used to distinguish between samples of untreated wild Swiss chard and treated with an insecticide containing a dangerous chemical component, namely alphacypermethrin.The following is the order of this paper: sample preparation, experimental setup, operating principle, and statistical analysis are covered in depth in the section under "materials and methods".The sensor network reactions to volatile organic compound (VOC) emissions from wild Swiss chard, principal component analysis (PCA), and support vector machines (SVMs) findings are presented in the "results and discussion" section.

MATERIAL AND METHOD 2.1. Sample preparation
At the national school of applied sciences in Khouribga in the kingdom of Morocco (geographical coordinates: latitude: 32°52′51″ N; longitude: 6°54′22″ W), leaves of wild Swiss chard were collected.The decision to use the wild Swiss chard was made to guarantee that our samples did not receive any pre-treatment.After selecting the plants under study, a survey was conducted in order to choose the most used insecticide to protect this plant from pests.Finally, the insecticide tractor 10EC, made using 100 g/L of alpha-cypermethrin, was chosen to treat the sample.
Chemically speaking, alpha-cypermethrin, with the formula C22H19Cl2NO3, is a fast-acting neurotoxic for insects but also has serious complications for people [18].To make the spray solution, 4 ml of the insecticide of choice was mixed with 1 liter of drinking water.The plants were split into two groups, a first group that was left naturally without treatment, and a second group that was exposed to treatment by a one-time spraying solution.After spraying, test samples were obtained from each group five times for a total of ten experiences per day over the course of four days, for a total of forty experiences.

Experimental design and working principle
In this investigation, a homemade electronic nose system was used as the name indicates, electronic noses are tools that can mimic the workings of the human olfactory system [19].Wilkens and Hartman [20] introduced the first electronic noses in 1964.However, Persaud and Dodd [21] research indicates that the idea of an electronic nose as an intelligent system for classifying odors did not fully take hold until 1982.
This device is composed of two distinct parts: a so-called hardware part and a software part.The hardware part is mainly composed of a network of metal oxide gas sensors housed in a chamber called the sensor chamber in addition to a fan, a sample chamber, a conversion and protection circuit, a data acquisition card, and finally, a laptop.In Figure 1, the developed measurement tool is shown schematically.

Figure 1. Measurement tool
The metal oxide gas sensors used in this work are those manufactured by the two most recognized companies in the field: the Japanese company Figaro Engineering and the Chinese company MQ.Table 1 lists said sensors with their gas target.After having designed our measurement tool, we moved on to the software part, this stage first requires the acquisition of data.In this regard, the DAQ1901 USB acquisition card was chosen and used, but the problem with this kind of card is that they are protected by large resistors at their inputs, which causes a voltage drop at their terminals.To deal with this small problem, a conversion and protection circuit has been developed.The latter is composed of amplifiers in buffer mode for impedance adaptation and Zener diodes to limit the voltage at the input of the acquisition card.
When using our instrument, the initial step entails taking 100 g samples and putting them within the sample chamber.Then, the device is switched on and the process begins by subjecting the samples to the fan's airflow for 10 minutes.The VOC in the wild Swiss chard enriches the airflow, which is then sent through a conduit to the sensors chamber.There, the sensors respond in accordance with their sensitivity to the volatile chemicals.Lastly, thanks to a program created with LabVIEW software, the data is saved in Excel format in a separate file for subsequent analysis.It's important to take into account that 20 tests for each type of sample were done.Vapors of organic solvents such as ethanol TGS 4161 Carbon dioxide, carbon monoxide, ethanol, and hydrogen TGS2620 Volatile organic vapors

Statistical analysis
Data pre-processing is required prior to utilizing machine learning algorithms to process the data.Centering and scaling are the first steps in the pre-processing process; in fact, the centering is done to eliminate any hypothesized shifts in the data.However, as in our instance, scaling is not required if every variable in the data set is measured using the same unit [22].
The process of feature extraction, which comes after the centering and scaling, entails observing the sensor responses to identify the traits that will distinguish the samples from one another.The features chosen are likely to be at different scales and the final step is to normalize them; in this case, we decided to do it by column to remove the scale effect.Now that our data is ready, the analysis can begin.For data analysis, two machine learning methods will be used: PCA SVM.These approaches were selected because they are simple, effective, and produce valuable classification results, making them some of the most often used multivariate analytic techniques.

Principal component analysis algorithm
A common basic classification technique, the PCA algorithm is an unsupervised linear pattern recognition technique, which is often exploited in electronic nose applications.This algorithm is used to project multi-dimensional data into a reduced-dimensional space (two or three dimensions) [23].This is because the data collected by electronic noses are usually in multi-dimensional space by reason of the considerably large number of gas sensors used and the numerous signal features extracted.
Assuming that the m*n matrix represents signal data collected from an electronic nose.The objective of the PCA algorithm is projecting the matrix of data to p (p˂n) linearly orthogonal uncorrelated vectors (PC_1, PC_2, PC_3, …) [24].The principal components (PC) coefficients can be obtained by calculating the eigenvectors of the covariance matrix of the original data set [25].Then, the projection of the data is done on the PCs after they have been chosen, and classification is consequently carried out based on predetermined standards (often the distance between groups of individuals).

Support vector machines algorithm
This method, developed by Cortes and Vapnik [26] in 1995, uses supervised learning to classify data using a linear and non-linear kernel function that attempts to discriminate between classes using hyperplanes.The latter, are created in a manner that they do not incorporate inner data and offer the widest possible border among class pairs.Support vectors are the data points on these hyperplanes.The optimal solution is a hyperplane that traverses the maximum distance between the two aforementioned hyperplanes; the corresponding equation is: Bulletin of Electr Eng & Inf ISSN: 2302-9285  An electronic nose for insecticides detection in food: the case of alpha-cypermethrin in Swiss … (Ali Amkor)

The sensor network responses to volatile organic compound emissions from wild Swiss chard
The sampling chamber contained, according to the experience, the samples of wild Swiss chard that had not been treated and those that had been treated with alphacypermethrin, and each time the fan helps transport the headspaces to the sensor chamber.In order to evaluate the stability of the curves, a 30-seconds margin is left before the procedure starts.In Figure 2, the sensor array responses to two samples (one from untreated Swiss chard and another from treated) are illustrated.The initial observation we make from the responses of the sensors is that, in contrast to the TGS821 and TGS4161 sensors, which barely move, the four sensors: TGS 822, TGS2620, MQ-136, and MQ-7 react to the presence of the samples by significantly increasing their output voltages.But the intensity with which the sensors react in response to the type of the samples is what is really fascinating.An intensity that will make it easier for us to tell them apart.After carefully examining the response curves, we have determined that the highest value, the curve area, and the stabilized value are the three key characteristics that distinguish between the treated and untreated samples.Consequently, our dataset has 12 columns (3 characteristics for each sensor) and 40 rows (the number of experiments).

Principal component analysis result
Since our data matrix is multidimensional (40*12), we initially chose to use the PCA for the projection and visualization of the data in a three-dimensional plane (PC_1, PC_2, and PC_3).Figure 3 illustrates the outcome.The graphic demonstrates how the individuals from the treated and untreated wild Swiss chard groups are correlated and categorized with a small amount of data overlap.A high rate of classification accuracy is envisioned since the graphic shows distinct borders between the two groups.A certain amount of misclassification is likely because there are a few overlapping individuals.With the contribution rate of the cumulative variance of about 96.5%, this indicates that most information is present and data loss is very minimal.So, we can rely on this result to visually distinguish between samples especially those treated with alpha-cypermethrin.In the following, we will use the SVM method because the PCA technique only provides illustrations in graphical form of data; it doesn't have a decision rule that enables it to identify unidentified samples.

Support vector machine result
As a supervised machine learning methodology [28], the SVM technique uses predetermined learning data groupings.In this instance, it depends on the previously known quality of the Swiss chard (treated or untreated).For the kernel function, one of the most often used kernels is the linear kernel, which is used in the present case.To test and validate the model, 5-fold cross-validation is employed.K-fold cross-validation ISSN: 2302-9285 Bulletin of Electr Eng & Inf, Vol. 12, No. 6, December 2023: 3374-3380 3378 provides an estimate of the reliability of a classifier.In K-fold validation, the full N-element dataset is partitioned into K subsets.Among the K subsets, one is retained as a test set and the remaining data (K-1) are used for training the classifier.Then the verification process is repeated K times, using exactly one of the K subsets as a test set each time.This method's benefit is that all observations are used for both in the train and test, with only one validation use per observation.For the classification and recognition of the Swiss chard kinds by the SVM algorithm, the information gathered from four sensors of our system (the homemade electronic nose) were exploited as the algorithm input, and the two kinds of swich chard (treated with alpha-cypermethrin or untreated) were employed as the groups of the output.The outcome from the MATLAB software's machine learning toolbox is shown in Figure 4. To have a clear visibility on the data, we decided to visualize the data on a twodimensional plane to better understand it, using the highest value from the TGS-822 sensor as the vertical axis and the stabilized value from the MQ-136 sensor as the horizontal axis.It should be noted that the training has taken a time of 0.31 seconds.An electronic nose for insecticides detection in food: the case of alpha-cypermethrin in Swiss … (Ali Amkor) 3379 treated and one sample from the group that was, which were wrongly classified.However, there was a very high success rate of about 92.3%.The findings, which show that our device can tell whether Swiss chard has been treated with alpha-cypermethrin or not, will open the door to the future development of a portable electronic nose specifically made for monitoring pesticides in crops.

CONCLUSION
For the efficient identification of wild Swiss chard samples treated with alphacypermethrin, an electronic nose comprised of a multisensor system and machine learning algorithms was used.First, the dataset was categorized using the PCA approach, which yielded a graphical classification on a three-dimensional plane with a cumulative variance of 96.5%.Second, SVMs with five-fold cross-validation were employed, and a success rate of roughly 92.3% was attained.Finally, we can assert that a straightforward, home-made electronic nose is reliable for identifying wild Swiss chard that has been sprayed with alpha-cypermethrin.
Bulletin of Electr Eng & Inf ISSN: 2302-9285  An electronic nose for insecticides detection in food: the case of alpha-cypermethrin in Swiss … (Ali Amkor)

Figure 2 .
Figure 2. Waveform response of sensors to a specimen of wild Swiss chard in LabVIEW

Figure 3 .
Figure 3.The result of PCA method

Figure 4 .
Figure 4.The SVM outcome for the nature-based categorization of Swiss chard

Table 1 .
Utilized sensors list