AgriEngineering, Vol. 8, Pages 290: Predicting Coffee Sensory Quality Using Machine Learning and Synthetic Terroir-Based Data
AgriEngineering doi: 10.3390/agriengineering8070290
Authors: Luiz Carlos Brandão Carla Simone Araújo Gomes Sarmento Odair Lacerda Lemos Ednilton Tavares de Andrade Ricardo Rodrigues Magalhães
The prediction of specialty coffee quality remains a central challenge for value addition in the agricultural sector. This study presents a computational approach to model the complex sensory quality of Arabica coffee (Coffea arabica L.) using synthetic data grounded in real-world statistics. A synthetic dataset (identical to the real dataset with a number of samples = 207) was generated using Cholesky decomposition based on the descriptive statistics and Pearson correlation matrix extracted from the Coffee Quality Institute (CQI) Arabica 2023 database, comprising 17 numerical variables including sensory attributes, defect counts, and Total Cup Points. The synthetic dataset achieved a Kolmogorov–Smirnov similarity of 89.55% with the real data, with the target variable Total Cup Points preserved with high fidelity (real mean: 83.71; synthetic mean: 83.65). An ordinal classification model (Random Forest) trained exclusively on the synthetic data and validated against real-world samples achieved an overall accuracy of 87.92% and a Quadratic Weighted Kappa (QWK) of 0.9502, indicating excellent agreement and confirming the model’s ability to capture the ordinal hierarchy of coffee quality. SHAP (SHapley Additive exPlanations) analysis revealed consistent feature importance rankings between real and synthetic domains, with Aftertaste, Overall, and Flavor emerging as the top three most influential predictors. This study validates the use of statistically grounded synthetic data for training robust machine learning models in agricultural research, demonstrating that synthetic environments can effectively replicate empirical patterns and enable cross-domain generalizability. The complete code and datasets are publicly available for reproducibility.

