Electronic tool coupled with machine learning algorithms for the detection of deltamethrin residues in Mentha Spicata L.

Insecticide residues in food are a real danger that threatens the health of living beings and therefore human health. In the present study, we propose an electronic nose system that performs collection, pre-treatment, and processing as well as data analysis and consequently decision-making to judge the presence of insecticide residues in the agricultural product. The present case is reserved for the evaluation of the presence of deltamethrin residues in the mint. The system is composed of two parts, the hardware part based on an array of commercial gas sensors


INTRODUCTION
A member of the Lamiaceae family (Taneja and Chandra, 2012), mint is a fragrant plant.It is a plant that is well regarded for its energizing scent, tasty flavor, and advantageous effects on health due to its vitamins, minerals, and antioxidant content (Chrysargyris et al., 2017).Mint has a variety of purposes and may be enjoyed in a variety of ways, whether for food, health, or personal care.Depending on personal tastes and needs, it can be ingested fresh, dried, or as an essential oil.
However, it should be noted that mint can present a real health problem to consumers due to treatment with insecticides, the treatment by which farmers try to protect their crops from insects and other pests.It has been shown many times when conducting laboratory analyses that this substance contains high levels of toxic insecticides.Depending on the chemical used, the insecticides should typically dissipate in at least one week, however, farmers are forced to pick before pre-registered dates due to ignorance, avarice, and demand pressure.The synthetic pyrethroid insecticide and acaricide known as deltamethrin is one of the world's most extensively exploited insecticides (Lu et al., 2019).It is one of the strongest pesticides now available and is frequently utilized to manage a variety of ectoparasites, such as lice, flies, and ticks, in order to safeguard crops, vegetables, and fruits.
Because pesticides are often used and damage human health, it is imperative to keep an eye on the quality of food.In order to do this monitoring, costly physicochemical tools such as gas and liquid chromatography, and spectroscopy with other techniques have been used for the determination of deltamethrin content in foods, where we found for the pineapple, the use of SLE-LTP extraction and gas chromatography (Morais et al., 2014).For olive oil, the use of reversed-phase high-performance liquid chromatography (Jaabiri, 2013).For eggplant, the use of liquid chromatography-mass spectrometry (Prodhan et al., 2015).For tomatoes, grapefruits, pears, green beans, oranges, and apples, the use of gas chromatography/mass spectrometry with negative chemical ionization (Belmonte Valles et al., 2012)...etc.However, these techniques are tedious, call for pricey equipment, and have a slow reaction time.The electronic nose is a new technology that has recently been widely utilized to check agricultural crops.Known for its construction low price, accuracy and utilization simplicity, in addition to being portable, this instrument has been used in various applications like environmental monitoring (Capelli et al., 2014), biochemical processing (Gu et al., 2017), pathology plants (Chang et al., 2014), pesticide detection (Amkor and El Barbri, 2022a) and cultivar selection (Trirongjitmoah et al., 2015).For our present case, which is interested in the detection of pesticides in food, the electronic nose was used for apples (Tang et al., 2021), black tea (Banerjee et al., 2019), and potatoes (Amkor and El Barbri, 2022b, 2023a, 2023b).
Given that the majority of insecticides have a distinct odor and that the electronic nose system is designed to sense gas molecules and substances, remains of pesticides in the mint might be picked up by the latter.To this end, we initially designed an electronic device based on an array of gas sensors.This device was produced and developed in our lab following a thorough investigation and comparison of commercial gas sensors.After that, an investigation was done to determine the most efficient machine learning algorithms that can differentiate treated mint from untreated one based on the information retrieved from the sensor matrix of our electronic nose.In our investigation, we will evaluate the following algorithms: DT, KNN, NB, and SVM.

Mint Used
The mint type Spicata L. was freshly harvested after ripening and was grown at the National School of Applied Sciences in Khouribga, Morocco.The initial planting samples were purchased from a local vendor.The farmed area was separated into two sections: one was left untreated and the other was sprayed with the product Decis Fluxx, which is a product that contains a dose of 25 g/L of the toxic material deltamethrin.Decis Fluxx was diluted in one liter of drinking water at a dose of 2 mL per liter, according to the dosage specified in the instructions.
Chemically known as C22H19Br2NO3, deltamethrin is a very dangerous pesticide that is used against insects or snakes and is effective whether touched or ingested.

Electronic Nose System and Sampling
The fundamental purpose of the electronic nose system is to mimic the workings of the human olfactory system which can detect and identify scents (Gardner, 2004).It is a tool that typically consists of a hardware component of a sensor network that serves as a receiver and a software component that employs pattern recognition algorithms that serve to analyze the information generated by the sensors.
As displayed in Fig. 1; the fan, sample chamber, sensor chamber, acquisition card (ADLINK USB 1901 DAQ), and laptop make up the electronic nose system created in our lab.

Fig. 1. Depiction of our electronic nose system
The receiver part (sensor array) is the main component, it is made up of four metal oxide gas sensors, as indicated in Table 1.
Table 1.The electronic nose system's sensor network Sensor Target gas TGS 822 Vapors of organic solvents such as ethanol MQ-136 Hydrogen sulfide, ammonia, Air, and carbon monoxide TGS 2620 Volatile organic vapors The gas sensors in use come with a sensitive element based on tin dioxide for their functioning principle (SnO2).The output of the sensor is directly impacted by the modification of the p-n junction (heterojunction) of this material, causing either a reduction in conductivity when an oxidizing gas is present or an increase in conductivity when a reducing gas is present (Nikolic et al., 2020).In order to modify the sensor's sensitivity, power inputs, and response outputs, the sensor array circuit additionally includes load resistors.
For the acquisition card used in this study, it is DAQ ADLINK USB-1901.It allows precise, fast and simple configuration by providing integrated signal conditioning, USB power and plug-and-play USB connectivity.
After test experiments, it turned out that the sensor response signals do not exceed the acquisition card, after verification, it was found that the acquisition card is protected by high resistance to its inputs, something that pushed us to build a card called an adaptation and protection card, the latter protects the acquisition card against over voltages and avoids voltage shutdowns.For protection, we used Zener diodes and resistors, and to avoid voltage shutdowns, we used operational amplifiers (TL082CP) in buffer mode.

The Measurement Process and the Data Collection
Five grams of each type of mint are placed into the sample chamber, where they are exposed to the fan's airflow for 8 minutes.The airflow carrying the volatile organic compounds found in the mint is then directed to the sensor chamber.Each sensor's sensitive layer undergoes an eightminute chemical interaction with the volatile organic chemicals in the mint.Depending on how sensitive it is to the chemical components of the odor, each sensor outputs a signal.After each experiment, the sensor array is cleaned by exposing it to ambient air for ten minutes after each measurement to return it to its original condition.
Thanks to this protocol, insecticide residues in mint may be effectively identified by a network of gas sensors due to the fact that the majority of insecticides have a characteristic odor and that the electronic nose mechanism detects a gas molecule, volatile chemicals, or olfactory signature.
In order to make a judgment, the sensor signals will be examined utilizing data processing and pattern recognition algorithms.LabVIEW software and the ADLINK USB 1901 DAQ acquisition card are used to capture the sensors' responses.
There will be an extraction of three datasets: XU: the mint dataset without treatment.XT: the mint dataset after Decis Fluxx treatment.XA: the whole dataset that includes all of the data.The final matrix, then, will be composed of three columns (the three sensors' reactions) and forty lines (5 samples × 2 types of mint × 4 numbers of days).

Data Pre-Processing
After collecting data and using equation (1), it has been possible to reference the raw signals' values to zero for reading purposes: where V0 is the initial voltage, Vm is the measured value, and Vr is the resultant relative voltage.
The significant information (features) from the sensor responses will then be extracted from the signal by close observation.Then, by dividing the features by the greatest value during the column normalization, the scaling impact is removed from the features: Xij is the ith sample of the jth sensor, Xi contains all the p responses for the sensors of the ith sample (Jurs et al., 2000).
Thanks to various machine learning techniques, the normalized characteristics retrieved from the collected data will be employed in categorization.

K-nearest Neighbors (KNN)
KNN, one of the most straightforward and effective supervised nonlinear pattern recognition techniques for data classification.It works by categorizing the unknown samples into the group to which the majority of the k nearby samples from the training set belong (Estakhroueiyeh and Rashedi, 2015), i.e., after providing the algorithm with a set of labeled data for training, any data with an unknown label (or class) will be trained by a vector in the features space.The unknown sample is assigned to the K closest points in the dataset based on the distance among each point in the dataset individually and the unknown sample.There are a number of ways to calculate the distance, but in our instance, the formula that is most frequently used-the Euclidean distance-was chosen.It may be calculated using the following formula: (3) With "a" and "b" the two points to calculate the distance between them and "n" the number of features.

Support Vector Machines (SVM)
SVM, a supervised learning approach that uses a kernel function that is either linear or non-linear to classify data, employs hyper-planes to try to discriminate between classes (Mathur and Foody, 2008).The optimal solution is a hyperplane that traverses the largest distance between the two hyperplanes.Consider the situation where the greatest distance between the two planes P1 and P2 that divide the scores is determined by the ideal hyperplane P0.P0 is characterized by: P o : . +  = 0 (4) Where W is the hyperplane's normal, b is the bias, and X is a point on the hyperplane.W must be reduced in order to maximize the margin.

Decision Trees Algorithm (DT)
For issues involving classification and regression, the DT is a supervised learning approach that may be employed (Cho and Kurup, 2011).It is a straightforward strategy that relies on anticipating the outcome by moving through the tree's decisions from the root node to the leaf node.Each branch is linked to criteria for making decisions.In the case of classification, the training data is used to build the model, which is then used to predict the class of those data.
We chose the binary statistics and machine learning toolboxTM trees in our situation since we wanted to distinguish between the mint that had been treated and the untreated one.Each prediction step considers the value of one predictor and checks it (a variable).

Naïve Bayes (NB) Classifier
The supervised machine learning algorithm NB Classifier is one of the other algorithms that is used for classification.The technique makes use of Bayes' theorem, which relies on previous knowledge of the circumstances surrounding an event to estimate the likelihood that it will occur.The Bayes theorem is described as: in where X and Y are unrelated.P(X|Y) is the likelihood of X occurring after Y has already occurred.The probability of two independent X and Y are P(X) and P(Y).P(Y|X) represents the likelihood of Y occurring after X has already occurred (Wijaya et al., 2017).

Sensor's Responses and Features Extraction
Beginning on the first day of our four-day experiment, when the pesticide was applied to the mint field treated, the sensor chamber received freshly gathered mint samples, which were subjected to an airflow produced by the fan for eight minutes with a delay of 30 seconds to assess the stability of the sensors.The headspace of the samples transmitted in the sensor chamber demonstrates an overall pattern of rise in the measured voltage at the output of the sensors as in our previous studies done with another insecticide namely malathion (Amkor et al., 2022c), shows a striking contrast between the two separate samples' replies (untreated and treated with Decis Fluxx) provided with the MATLAB program, (see Fig. 2 in support).
In Fig. 2, the reaction signals from the sensors reveal that while they all exhibit a similar response, the signals related to the mint that was treated with the Decis Fluxx product throughout the four days are stronger than those related to the untreated mint.
By careful observation of the responses provided by the sensor array illustrated in Fig. 2, a lot of characteristics can be extracted from the sensor response signals.In our case, we chose to work with the maximum values of the signal, its occupied area between the 40 s and 240 s, and its stabilized values between the 450 s and 480 s.

Comparison of Some Classification Algorithms in
Differentiating between Untreated Mint and Treated One The classification learner application from the statistics and machine learning toolbox in MATLAB 2019a was utilized in this investigation.It serves as a toolbox with features and programs for describing, analyzing, and modeling data.To evaluate the model and avoid overfitting while obtaining classification accuracy, a 5-fold cross- validation approach was performed.Fig. 3 displays the outcome for four methods namely DT, KNN, NB and SVM.Those algorithms, or some of them, were used in different comparative studies, such as in the identification of COVID-19 viruses (El Boujnouni, 2022), in the classification and prediction of the treated mint with malathion (Amkor et al., 2022c), and in automated text classification (Ababneh, 2019).For the DT outcomes shown in Fig. 3(a) and (a'), this was the lowest success rate (87.5%) recorded among the other algorithms used, with five misclassified scores, two from the untreated group and three from the treated one.For KNN and the NB results revealed successively in Figs. 3(b) and (b') and Figs. 3(c) and (c'), a not-bad success rate was achieved, which is 92.5%, with three scores misclassified, one from the untreated mint and two from the treated one.

CONCLUSION
The current study presented a proposal for an electronic nose system that was created and used to detect the presence of insecticide residues containing the dangerous substance deltamethrin in edible mint.To identify the deltamethrintreated mint, four artificial intelligence (AI)-based classification methods-DT, NB, KNN, and SVM-were evaluated.The outcomes showed that, in comparison to the others, the SVM achieved the highest result with a rate of success of 95%.These findings are interesting because they demonstrated the viability of utilizing a basic electronic nose with artificial intelligence to distinguish between untreated and mint treated with deltamethrin-containing insecticides provided that appropriate machine learning algorithms are chosen.The system can be easily adapted to monitoring insecticides in different agricultural products.

Fig. 2 .
Fig. 2. The sensors' reactions on the first day of sprayingDue to the cross-sensitivity of the sensors, a great deal of information has been discovered and detected in the response signals of the sensors.The difference in the responses of the sensors is undoubtedly caused by the different nature of the volatile compounds emitted by each kind of mint.The methods for data analysis and processing can be utilized to tell untreated mint from treated one.

Fig. 3 .
Fig. 3.The outcome of each technique and its confusion matrix