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
- 1Centro Surcolombiano de Investigación en Café (CESURCAFÉ), Departamento de Ingeniería Agrícola, Universidad Surcolombiana, Neiva-Huila, 410001, Colombia; University Institute of Food Engineering-FoodUPV, Universitat Politècnica de València, Camino de Vera s/n, València, 46022, Spain
- 2Centro Surcolombiano de Investigación en Café (CESURCAFÉ), Departamento de Ingeniería Agrícola, Universidad Surcolombiana, Neiva-Huila, 410001, Colombia; Departamento de Ingeniería Agroindustrial, Facultad de Ingeniería, Universidad Surcolombiana, Neiva, Huila, 410001, Colombia; Corresponding author.
- 3Centro Surcolombiano de Investigación en Café (CESURCAFÉ), Departamento de Ingeniería Agrícola, Universidad Surcolombiana, Neiva-Huila, 410001, Colombia
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.
Related
- Immobilization of Pepsin on Different Nanomaterials and Its Application in Obtaining Bioactive Peptides
- A computational framework for modeling fluid and solid stresses in porous tissues with application to the trabeculated embryonic heart
- Texture and microstructural evolution in an Al-6061 alloy processed by high-pressure torsion
- Solution-processed Ti3C2Tx MXene coatings for three-dimensional microelectrodes in label-free single-cell impedance spectroscopy
- DSC analysis of dissolution reaction in an as-cast and HPT-processed Mg-Gd alloy
BibTeX
@article{collazosescobar2026application,
title = {{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}},
author = {Gentil A. Collazos-Escobar and Andrés F. Bahamón-Monje and Nelson Gutiérrez-Guzmán},
journal = {Data in Brief},
year = {2026},
month = aug,
doi = {10.1016/j.dib.2026.113343},
url = {https://doi.org/10.1016/j.dib.2026.113343},
note = {CC BY},
}
RIS
TY - JOUR
TI - 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
AU - Gentil A. Collazos-Escobar
AU - Andrés F. Bahamón-Monje
AU - Nelson Gutiérrez-Guzmán
PY - 2026
DA - 2026/08/01
JO - Data in Brief
DO - 10.1016/j.dib.2026.113343
UR - https://doi.org/10.1016/j.dib.2026.113343
AB - 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.
SN - 2352-3409
ER -