Rapid detection of base liquor grades using near-infrared spectroscopy and SHAP-enhanced interpretable ensemble learning models
摘要
To achieve rapid detection of base liquor grades in strong-aroma Baijiu and enhance the interpretability of predictive models, this study developed an evaluation framework based on near-infrared (NIR) spectroscopy. First, a 9-point second-order Savitzky–Golay convolution derivative was applied to preprocess the spectra, effectively reducing spectral noise and baseline drift, which improved prediction accuracy by 8.27%. Subsequently, the Elite Neighborhood Search and Dynamic Feature Probability-Guided Crow Search Algorithm (NNS-DFPG-CSA) was utilized reducing the original 1215-dimensional spectral features to 63 dimensions, thereby significantly lowering data redundancy and model complexity. Furthermore, Bayesian optimization (Optuna) was employed to fine-tune and establish classification models using XGBoost, Light GBM, Cat Boost, Random Forest (RF), and Extremely Randomized Trees (ERT). The highest accuracy, precision, recall, and F1-score achieved were 97.92%, 97.92%, 98.27%, and 97.63%, respectively. Model interpretation with Shapley Additive exPlanations (SHAP) revealed that spectral features around 6000 cm⁻¹ contributed most significantly across different models, primarily corresponding to hydroxyl and carbonyl compounds, manifesting in the base liquor as esters and acids. These results demonstrate that the proposed approach enables rapid, non-destructive detection of Baijiu base liquor grades while improving model interpretability, providing a valuable reference for liquor grading and the broader application of NIR spectroscopy.