Observational analysis evaluates milk quality classification using machine learning algorithms, suggesting reliable automated assessments.
Milk quality assessment is of critical importance for food safety and public health. Traditional milk quality evaluation relies on physicochemical measurements that require expert interpretation and may not directly support rapid or large-scale decision-making, increasing the need for data-driven and automated assessment methods. Although machine learning-based approaches have been widely applied in milk quality classification in recent years, the lack of transparency in model decision mechanisms and insufficient reporting of data preprocessing and data leakage control procedures pose significant limitations in terms of reliability. In this study, the milk quality classification performance of various supervised machine learning algorithms is comparatively evaluated using an open-access milk dataset. Random Forest (RF), k-Nearest Neighbors (KNN), Support Vector Machines (SVM), Extreme Gradient Boosting (XGB), Light Gradient Boosting Machine (LGBM), and Artificial Neural Network (ANN) models are assessed under fair and consistent experimental conditions. The main contribution of this study lies in the application of group-based data partitioning strategies to prevent data leakage, rather than directly removing duplicate or highly similar records from the dataset. This approach prevents data loss and enables a more realistic evaluation of model performance. Furthermore, a targeted and minimalist preprocessing strategy is adopted by applying scaling exclusively to continuous variables. For hyperparameter optimization, Grid Search and Particle Swarm Optimization (PSO) methods are employed; notably, tree-based models optimized using PSO demonstrate more consistent classification performance. To move beyond predictive accuracy, Explainable Artificial Intelligence (XAI) approaches are utilized to enhance the interpretability of model decisions. In this context, SHapley Additive exPlanations (SHAP) and Local Interpretable Model-agnostic Explanations (LIME) methods are applied to analyze the contributions of key features influencing milk quality. Experimental results indicate that physicochemical properties, particularly pH, fat content, and temperature, play a decisive role in milk quality prediction. In conclusion, this study demonstrates that the combined use of machine learning and explainability techniques provides significant contributions in terms of reliability, transparency, and methodological robustness in milk quality classification.
No takes yet. Share an insight, caveat, or question.
Çetinkaya et al. (2026) studied this question.
Synapse has enriched 5 closely related papers on similar clinical questions. Consider them for comparative context: