# Classification of Retail Products: From Probabilistic Ranking to Neural Networks
## 9 Evaluation and Results  
For evaluation purposes, we have implemented the approaches using different tools and programming languages: (i) R (Rstudio) to pre-process the data set and then (ii) Matlab and Python to implement machine learning algorithms and deep neural networks. We have analyzed the usual parameters of each algorithm: (i) \(k\) and the distance for KNN and FKNN because these two parameters are the ones that condition the algorithm Section 6; and (ii) the number of hidden layers, the number of nodes and the number of epochs for MLP are the three most relevant parameters that condition the algorithm of neural networks Section 8. Figure 4: MLP structure. ```
1:procedureTuning_Parameters(Train_600, Test_600)
2:\(Learning\_RateLR=0.001\);\(Hidden\_layerHL=3\)
3:\(Number\_of\_Node\;N\);\(Training\_epochs\;T\);
4: Label C1\(\triangleright\) 1 st Variety
5: Label C2\(\triangleright\) 2 nd Variety
6: Label C3\(\triangleright\) 3 rd Variety
7:for\(N\gets 300:800\) by 100 do
8:for\(T\gets 100:800\) by 100 do
9:\(Model\;M\leftarrow\) build_model_MLP(Train_600, Test_600, \(HL\), \(LR\) )
10:\([\text{C1},\text{C2},\text{C3}]\leftarrow\text{Predict(}M\), Test_600)
11:\(T\gets T+1\)
12:endfor
13:\(N\gets N+1\)
14:endfor
15:\(Top\_1\gets C1\)
16:\(Top\_2\gets C1\) & C2
17:\(Top\_3\gets C1\) & C2 & C3
18:return\(Top\_1\),\(Top\_2\),\(Top\_3\)
19:endprocedure
```  
**Algorithm 3** Tuning parameter for MLP to the reduce MDD-DS with 600 principal components and with a total of 159 classes (varieties)  
In order to evaluate the different approaches, we randomly split the data from the _product matrix_ obtained from the dataset into a training set (\(\simeq 90\%\) of the data) and a testing set (\(\simeq 10\%\) of the data). The evaluation performed on some of the measure parameters, such as accuracy, precision, recall, and \(F1\)-score [53] as shown in Equation (9). These parameters are obtained from (i) True Positive (\(TP\)) (when the real value is positive and prediction is positive); (ii) True Negative (\(TN\)) (when the real value is negative and the prediction is negative); (iii) False Positive (\(FP\)) (when the real values is negative but the prediction is positive); and (iv) False Negative (\(FN\)) (when the real value is positive but the prediction is negative). Therefore, accuracy is described as the ratio of correctly classified instances, which is the total number of correct predictions divided by the total number of  
Figure 5: Accuracy of MLP for the three approaches: \(Top\_1\), \(Top\_2\), and \(Top\_3\). predictions made for a dataset; meanwhile, precision and recall are used to quantify how well the proposed algorithm matches the ground truth. Precision quantifies the number of positive class predictions that actually belong to the positive class. In addition, Recall quantifies the number of positive class predictions made out of all positive examples in the dataset. Finally, the F1-score provides a way to combine both precision and recall into a single measure that captures both properties:  
\[Accuracy=\frac{TP+TN}{TP+TN+FP+FN} \tag{9}\] \[Precision=\frac{TP}{TP+FP}\] \[Recall=\frac{TP}{TP+FN}\] \[F1-Score=2*\frac{Precision*Recall}{Precision+Recall}\]  
Table 8 and Figure 6 summarize the performance of our score-based approach, based on the BM25 model. We evaluate the performance of our nearest neighbors models over a reduced dimension dataset with 400, 500, 600, 700, and 800 principal components. KNN results are shown in Table 9. The results represent the best values for _Top_1: 700 principal components with Accuracy (0.8427). The best fit with _Top_2_ is 600 principal components with Accuracy (0.8874). However, 500 principal components are also suitable for the F1-score (0.8241). In addition to the _Top_3_, the exact result is 400 principal components with Accuracy (0.9201). On the other hand, 700 principal components are also suitable for the F1-score (0.8263). Regarding FKNN, Table 10 illustrates that the best fit with _Top_1_ for FKNN is 800 principal components with accuracy (0.8459).