# Leveraging IGOOSE-XGBoost for the Early Detection of Subclinical Mastitis in Dairy Cows
## 5 Prediction Model for Subclinical Mastitis in Dairy Cows Based on IGOOSE-XGboost
### Building the IGOOSE-XGBoost Classification Model
#### 5.2.2 Building an IGOOSE-XGBoost Classification Model for Subclinical Mastitis in Dairy Cows  
The intelligent optimization algorithm combined with XGBoost for feature selection and classification tasks is a powerful method that can help to find the best features in complex datasets and train high-performance classifiers. First, the dataset was split into an 8:2 ratio between a training set and a test set. The dataset was subjected to feature selection using the IGOOSE algorithm, GOOSE algorithm, SSA algorithm, HBA algorithm, HO algorithm [31], and DBO algorithm, respectively. Then, the XGBoost classification algorithm was used to classify and predict the data after feature selection. The number of algorithm populations was set to 30, the number of iterations was set to 1000, and an average of 50 experiments were used to confirm the results' scientific nature. Six assessment indicators--accuracy, number of selected features, algorithm fitness value, recall rate, precision rate, and F1 score--were employed to compare the algorithms' performance in feature selection. Table 4 displays the findings. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Algorithm** & \begin{tabular}{c} **Average** \\ **Accuracy** \\ \end{tabular} & **Average Recall** & \begin{tabular}{c} **Average** \\ **Precision** \\ \end{tabular} & \begin{tabular}{c} **Average F1** \\ **Score** \\ \end{tabular} & \
\begin{tabular}{c} **Average** \\ **Fitness Value** \\ \end{tabular} &
\begin{tabular}{c} **Average** \\ **Number of** \\ **Features** \\ \end{tabular} \\ \hline SSA & 0.83 \(\pm\) 0.016 & 0.80 \(\pm\) 0.018 & 0.75 \(\pm\) 0.017 & 0.77 \(\pm\) 0.015 & 0.170 \(\pm\) 0.0024 & 9.12 \(\pm\) 0.42 \\ HBA & 0.81 \(\pm\) 0.014 & 0.83 \(\pm\) 0.016 & 0.77 \(\pm\) 0.014 & 0.79 \(\pm\) 0.014 & 0.161 \(\pm\) 0.0021 & 10.08 \(\pm\) 0.45 \\ CPO & 0.83 \(\pm\) 0.015 & 0.85 \(\pm\) 0.017 & 0.71 \(\pm\) 0.016 & 0.75 \(\pm\) 0.015 & 0.163 \(\pm\) 0.0023 & 6.05 \(\pm\) 0.31 \\ DBO & 0.80 \(\pm\) 0.017 & 0.78 \(\pm\) 0.019 & 0.73 \(\pm\) 0.018 & 0.77 \(\pm\) 0.016 & 0.163 \(\pm\) 0.0022 & 6.07 \(\pm\) 0.33 \\ GOOSE & 0.84 \(\pm\) 0.015 & 0.84 \(\pm\) 0.017 & 0.74 \(\pm\) 0.016 & 0.79 \(\pm\) 0.014 & 0.163 \(\pm\) 0.0021 & 7.10 \(\pm\) 0.38 \\ IGOOSE & 0.85 \(\pm\) 0.013 & 0.87 \(\pm\) 0.015 & 0.76 \(\pm\) 0.014 & 0.80 \(\pm\) 0.013 & 0.151 \(\pm\) 0.0019 & 6.04 \(\pm\) 0.28 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Comparison of evaluation indicators of different classification models. Table 4 shows the classification results of the different models after feature selection of the dataset. The experimental data show that among the six algorithms, the IGOOSE-XGBoost model achieves the highest average classification accuracy of 0.85 \(\pm\) 0.013 after feature selection. In addition, the model has the highest recall (0.87 \(\pm\) 0.015) and F1 score (0.80 \(\pm\) 0.013). It is noteworthy that IGOOSE-XGBoost still achieved such excellent performance while maintaining a condensed feature set of only six features. In terms of fitness value, the IGOOSE-XGBoost model also outperforms the other models with a value of 0.151 \(\pm\) 0.0019, indicating the best optimization. The standard deviations of all the evaluation indexes were controlled within a small range (\(\leq\)0.02), reflecting the high repeatability and reliability of the experiment. Analyses with [PERSON]'s test show significant differences between the algorithms (\(\chi^{2}\) = 4.93, \(p\) < 0.05). In particular, the IGOOSE-XGBoost model shows significant advantages in several assessment metrics, mainly in terms of accuracy (\(p\) < 0.05), recall (\(p\) < 0.05), and fitness value (\(p\) < 0.05). Although the improvement in precision rate is relatively modest, it is still statistically significant (\(p\) < 0.05). In terms of feature selection efficiency, IGOOSE consistently selects a compact feature set, which demonstrates its ability to identify the most relevant features while still maintaining high predictive performance.