Adaptive neuro-fuzzy inference systems for improved mastitis classification and diagnosis.
Journal:
Scientific reports
Published Date:
Jul 1, 2025
Abstract
For modeling dairy cattle data, fuzzy logic offers the capability to manage uncertainty, enhance accuracy, facilitate informed decision-making, and optimize resource allocation. A critical aspect of dairy cattle production is the modeling of mastitis, an udder infection that affects milk quality and yields significant economic consequences. The aim of this study was to compare the performance of three adaptive neuro-fuzzy inference systems (ANFIS) classification methodologies in classifying mastitis in Holstein dairy cattle: gradient descent (GD)-based ANFIS (GD-ANIFIS), particle swarm optimization (PSO)-based ANFIS (PSO-ANFIS) and genetic algorithm (GA)-based ANFIS (GA-ANFIS). Two feature reduction techniques were used to reduce data dimensions and improve model performance: Pearson correlation and principal component analysis. The dataset exhibited a problem of class imbalance, with the majority class (non-mastitis cases) being over-represented. To address this issue, an undersampling algorithm was applied to balance the class distribution by removing a portion of the majority class data. ANFIS models were evaluated using training and test datasets, and performance metrics derived from confusion matrix (accuracy, precision, recall, F1-score). The results showed that the GD-ANFIS model integrated with the Pearson method demonstrated superior performance compared to PSO-ANFIS and GA-ANFIS across key evaluation metrics such as accuracy and error rates. However, due to the interplay of multiple evaluation criteria and the closely clustered fitted values, determining a definitive best model almost remained challenging In addition to improving udder health, milk quality, and economic viability, this research can contribute to ongoing soft computing efforts to improve mastitis detection and management in dairy cattle. To ensure transparency and reproducibility, all MATLAB codes utilized in this study are included in the appendix. In precision dairy farm production, these codes may serve as a foundation for developing mobile applications.