# 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
IGOOSE's greater optimization power is demonstrated by the fact that its fitness value (0.151 \(\pm\) 0.0019) is much lower than that of the other algorithms (\(p\) < 0.05). In addition, the narrow confidence intervals for all the evaluated metrics indicate that the results are highly reliable and reproducible. The IGOOSE algorithm shows unique advantages in the feature selection process: not only can it achieve the best performance while maintaining a small number of features, but it also considers the interactions between the features during the feature selection process and effectively avoids local optimal solutions through the iterative optimization process. The swarm intelligence optimization algorithm not only helps to determine the most representative feature subset, but also searches for the parameter space to find the optimal parameter combination to enhance the model's functionality and capacity for generalization. Next, based on feature selection, the corresponding intelligent optimization algorithm simultaneously optimizes the parameters (maximum number of iterations, depth, learning rate) of the classifier XGBoost. The results are shown in Table 5.  
Table 5 shows the classification results of each algorithm after parameter optimization. The prediction performance of the IGOOSE-XGBoost model is significantly improved in all metrics: the accuracy rate is increased to 0.87 \(\pm\) 0.012, the precision rate reaches 0.89 \(\pm\) 0.013, the recall rate stays at a high level of 0.88 \(\pm\) 0.014, and the F1 score is improved to 0.88 \(\pm\) 0.012. The standard deviation of all evaluation metrics remained below 0.014, indicating that the model has good stability. By comparing prediction performance, precision, recall, F1 score, fitness value, and number of features, it can be observed that the IGOOSE-XGBoost model has the best prediction effect. \begin{table}
\begin{tabular}{l c c c c c} \hline \hline
**Algorithm** & **Average Accuracy** & **Average Recall** & **Average Precision** & **Average F1 Score** & **Average Fitness Value** \\ \hline SSA & 0.83 \(\pm\) 0.015 & 0.81 \(\pm\) 0.017 & 0.80 \(\pm\) 0.016 & 0.79 \(\pm\) 0.015 & 0.158 \(\pm\) 0.0023 \\ HBA & 0.84 \(\pm\) 0.014 & 0.83 \(\pm\) 0.016 & 0.79 \(\pm\) 0.015 & 0.80 \(\pm\) 0.014 & 0.147 \(\pm\) 0.0021 \\ CPO & 0.84 \(\pm\) 0.015 & 0.87 \(\pm\) 0.016 & 0.78 \(\pm\) 0.015 & 0.85 \(\pm\) 0.014 & 0.148 \(\pm\) 0.0022 \\ DBO & 0.84 \(\pm\) 0.016 & 0.89 \(\pm\) 0.017 & 0.84 \(\pm\) 0.016 & 0.79 \(\pm\) 0.015 & 0.148 \(\pm\) 0.0023 \\ GOOSE & 0.85 \(\pm\) 0.014 & 0.84 \(\pm\) 0.016 & 0.78 \(\pm\) 0.015 & 0.81 \(\pm\) 0.014 & 0.146 \(\pm\) 0.0020 \\ IGOOSE & 0.87 \(\pm\) 0.012 & 0.88 \(\pm\) 0.014 & 0.89 \(\pm\) 0.013 & 0.88 \(\pm\) 0.012 & 0.145 \(\pm\) 0.0018 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Comparison of evaluation indicators of different models with statistical measures. From the perspective of disease prediction, recall is of particular importance. Lower recall means that many cows that are sick may be misclassified as healthy, which will delay diagnosis and treatment. The IGOOSE-XGBoost model (0.88 \(\pm\) 0.014) and the DBO-XGBoost model (0.89 \(\pm\) 0.017) perform well in terms of recall. A higher recall rate helps with disease prevention and early diagnosis and treatment. Considering all the metrics together, the IGOOSE-XGBoost model demonstrates the best overall prediction. For the parameter-optimized model, IGOOSE-XGBoost shows significant improvements in accuracy, precision, and F1 score (\(p\) < 0.05). The smaller standard deviation (\(\leq\)0.014) and narrow confidence interval further demonstrate the high stability and reliability of this model. Through parameter optimization, the model not only improves predictive accuracy, but also maintains the consistency and reproducibility of the results. These modifications result in more rigorous and coherent content while maintaining scientific and readability.