# Predicting the Impact of Data Poisoning Attacks in Blockchain-Enabled Supply Chain Networks
## 4 Experiment
### The Experiment's Models' Training and Evaluation  
In this section, a data poisoning attack on the machine learning model was conducted and compared with the non-poisoned models; data poisoning is a type of adversarial attack that aims to manipulate the training data of a machine learning algorithm to degrade its performance or accuracy [27; 28].  
The experiment was conducted using several machine learning models, and each model was evaluated using its F1 Score, confusion matrix, and accuracy. The algorithms include logistic regression, random forest, support vector machine and XGBoost, an eight-layer neural network model was also tested, which was trained using the Adam optimiser and binary cross-entropy loss function. A random label flipping with 20% randomness was introduced, and the dataset was split into training and test sets using an 80-20 split. The training set contains 125,973 records, and the test set contains 25,194 records.  
Figure 6 shows the decision boundaries of different machine learning models for the network anomaly detection task. The function scaled the data using a StandardScaler from sklearn and applied PCA to reduce X to two components. The output showed that different models had different complexity and accuracy in their decision boundaries. Some models, such as random forest, SVC and XGB had curved and complex decision boundaries that could capture more nonlinear patterns and variations. Other models like the logistic  
Figure 5: Experiment design map.  
regression had simpler decision boundaries that could capture only the basic trends and differences. The output also showed that different models had different prediction errors and uncertainty. Some models, such as the random forest and SVC, had fewer misclassified data points in the wrong colour region.  
The results show the performance metrics of seven different machine learning models when trained on a dataset without poisoned samples. The models used are logistic regression, Figure 7a; random forest, Figure 7b; support vector classifier (SVC), Figure 7c; and XGBoost, Figure 7d.  
All models have reasonable accuracy, as shown in Table 2, with the lowest being random forest at 0.825 and the highest being 0.858 with the logistic regression model. The models show F1 scores ranging from 0.822 with SVC to 0.868 with logistic regression. In terms of precision, all models have values higher than 0.9. This indicates that the models have low false positive rates, and their recall values range from 0.72 with XGB to 0.82 with the logistic regression.  
\begin{table}
\begin{tabular}{c c c c c} \hline  & **LR** & **Random Forest** & **SVC** & **XGB** \\ \hline Acc & 0.85,81884315117104 & 0.82,52306600425834 & 0.84,6829607723754 & 0.82,94889992902768 \\ F1 & 0.86,8246454976303 & 0.82,2841726618705 & 0.84,6829607723754 & 0.82,78857347541864 \\ Prec & 0.92,14485654303709 & 0.97,26799192090996 & 0.95,81734081291211 & 0.97,3055467845899 \\ Recall & 0.82,08524896750565 & 0.71,30055326112367 & 0.75,86690563391257 & 0.72,04083222940856 \\ \hline \end{tabular}
\end{table}
Table 2: Model evaluation metrics without data poisoning.  
Figure 6: Non-poisoned models training.