Application of partial least squares discriminant analysis to mid-infrared spectral data for discriminating green and roasted coffee processed by different post-harvest methods: MATLAB- and R-based computational tools and modeling pipelines.
Gentil A Collazos-Escobar, Andrés F Bahamón-Monje, Nelson Gutiérrez-Guzmán
Centro Surcolombiano de Investigación en Café (CESURCAFÉ), Departamento de Ingeniería Agrícola, Universidad Surcolombiana, Neiva-Huila, 410001, Colombia.
Key points
From the paper's conclusion- The integrated dataset and computational tools provide a reproducible framework for investigating the potential of mid-infrared spectroscopy to discriminate coffee post-harvest processing methods and support further developments in coffee authentication, quality control, and the application of chemometric methods to agri-food spectral data.
Abstract
This article presents a mid-infrared spectral dataset of green and roasted specialty coffee subjected to wet (W), semi-dry (SD), and dry (Dr) post-harvest processing, accompanied by MATLAB-based feature-extraction tools and R-based Partial Least Squares Discriminant Analysis (PLS-DA) modeling pipelines for discriminating coffee according to its post-harvest processing method. The dataset comprises raw, baseline-corrected, Standard Normal Variate (SNV), Multiplicative Scatter Correction (MSC), and Savitzky-Golay first- (D1) and second-derivative (D2) spectra, enabling the investigation of spectral variability associated with post-harvest processing and roasting, as well as the influence of spectral preprocessing on classification performance. The MATLAB routines extract six quantitative spectral features: integral (INT), energy (ENG), standard deviation (STD), skewness (SKE), kurtosis (KURT), and entropy (ENT). The R workflow provides an interactive framework for PLS-DA modeling based on four predictor representations: (i) full-spectrum data, (ii) full-spectrum data restricted to predefined spectral regions, (iii) features extracted from the entire spectrum, and (iv) features extracted from predefined spectral regions. Models can be developed using green coffee, roasted coffee, or both stages and configured for either multiclass discrimination among W, SD, and Dr processing methods or pairwise binary discrimination (W vs. Dr, W vs. SD, and SD vs. Dr). The computational pipeline integrates class definition, stratified training-validation partitioning, model calibration and prediction, K-fold out-of-fold cross-validation (OOF-CV), holdout validation, confusion matrices, overall and class-specific classification metrics, and visualization of scores, loadings, variable importance in projection (VIP), and model diagnostics. Metadata describing the post-harvest processing method and coffee stage are included to facilitate sample traceability and model interpretation. The integrated dataset and computational tools provide a reproducible framework for investigating the potential of mid-infrared spectroscopy to discriminate coffee post-harvest processing methods and support further developments in coffee authentication, quality control, and the application of chemometric methods to agri-food spectral data.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Mid-infrared spectral dataset, MATLAB-based feature extraction tools and R-based Partial Least Squares Discriminant Analysis workflow for discriminating green and roasted specialty coffee according to post-harvest processing methodMendeley Data · 2026
- Complementary spectral and volatile fingerprints enable discrimination of post-harvest processed arabica coffee using NIR spectroscopy and HS-GC-IMS.Food chemistry · 2026
- A simple scattering-descriptor framework for NIR analysis of particulate foods: the case of Arabica cultivar classificationFood Control · 2026
- ATR-FTIR Spectroscopy and PLS-DA as a Screening tool to Support Q-Grader Classification of Brazilian Arabica Coffee into Fine and Phenicated CategoriesFood Analytical Methods · 2026
- Coffee brew quality approved by photoionization mass spectrometry: Predicting sensory perception of coffee beverage during the roasting process in real-time.Food chemistry · 2026
- Discrimination of plant-based milk alternatives: a pilot study comparing mid and near-infrared spectroscopy.Analytical and bioanalytical chemistry · 2026