Pre-manufacturing prediction of jaggery color formation through soil and water parameters using machine learning Authors: Kathirvel Narayanasamy, Ilayaraja Venkatachalam Published: 2026 ABSTRACT Jaggery, a traditional unrefined sugar produced from concentrated sugarcane juice, represents a critical economic sector supporting over 50 million rural livelihoods globally. Jaggery color determines market pricing, with Golden variants commanding 40–60% premium; yet current assessment relies on subjective evaluation and costly chemical interventions. This study presents a machine learning (ML) framework for pre-manufacturing jaggery color classification using agricultural and chemical parameters measurable during sugarcane procurement. Analysis of 2001 sugarcane samples from four varieties across three seasons in Erode, Tamil Nadu, achieved 98.3% test accuracy across three color categories (Golden, Light brown, Dark brown) with Random Forest and Gradient Boosting classifiers. Color labels were assigned through expert visual grading and independently verified under standardized conditions; however, no instrumental colorimetric measurements were used, which constitutes a limitation of the ground truth. Feature importance analysis revealed soil type and water type as the strongest predictive associations within this regional dataset, collectively accounting for 62.93% of predictive importance. Three-tier validation including cross-validation, bootstrap resampling, and Leave-One-Location-Out analysis across 19 locations confirmed robust within-region generalization. Computational efficiency (0.017 s prediction time) supports mobile device deployment. This framework provides quantitative evidence for the predictive associations between cultivation conditions and color outcome, enabling a shift from reactive to proactive quality management. Validation is currently restricted to the Erode region; multi-regional testing is required before broader deployment. No external validation across distinct agroecological systems has been conducted. Introduction Background and significance Jaggery, a traditional unrefined sugar product derived from concentrated sugarcane juice, plays a critical role in the global natural sweetener market, particularly in rural agro-industries dependent on decentralized sugarcane processing. The jaggery industry operates primarily through small-to-medium-scale rural enterprises, with India contributing approximately 70% of global output (approximately 11 million metric tons annually). Production predominantly employs traditional open-pan heating methods, in which sugarcane juice is concentrated through evaporation at temperatures of 110–130 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$^\circ$$\end{document}C, resulting in solid blocks ranging in color from golden-yellow to dark brown. Although production intensity is highest during the peak sugarcane harvest period (October–March), jaggery manufacturing is not strictly seasonal and continues throughout the year in many regions, supported by staggered harvesting practices, irrigation availability, and localized market demand. Typical production units process approximately 5–10 tons of sugarcane per day. Despite its economic significance, the jaggery industry faces fundamental quality prediction challenges that limit production optimization and market efficiency. Color classification serves as the primary determinant of market value, with Golden variants commanding premium prices over brown alternatives due to superior organoleptic properties and extended shelf life1–4. The growing market for packaged jaggery (projected CAGR of 6.8% through 2033, reaching USD 2.1 billion)5 reflects increasing quality consciousness among consumers. While current pricing for cane farmers is typically based on sugar yield per metric ton, the ability to predict jaggery color prior to processing adds an important dimension to quality assessment. By combining sugar yield and color classification, producers can consistently offer higher quality products, thereby preventing economic losses and enabling fairer price setting for farmers6. Jaggery production represents a critical economic sector supporting over 50 million rural livelihoods globally1,5. Beyond economic significance, jaggery provides essential nutritional benefits as an unrefined natural sweetener rich in iron (11 mg/100g), magnesium (70–90 mg/100g), potassium (1050 mg/100g), and calcium, serving as a healthier alternative to refined sugar in traditional diets. Health benefits include improved hemoglobin levels (iron content supports anemia prevention), enhanced digestion (alkaline nature aids digestive enzyme activity), and respiratory health (traditional medicine uses for cough/cold relief). Unlike refined sugar, jaggery retains natural minerals and phytochemicals derived from sugarcane, thereby offering micronutrient supplementation that is particularly valuable in nutritionally vulnerable rural populations3,4. Current quality assessment relies primarily on subjective visual evaluation by experienced manufacturers, leading to inconsistent standards and costly chemical interventions that increase production costs by 30–40% while compromising natural product characteristics. This cost escalation was documented through exploratory field visits to over 50 manufacturing units across the Erode region during the 2023–2024 production seasons. This prediction gap forces suboptimal decision-making across industrial-scale operations, particularly in major producing regions where manufacturers must guarantee color outcomes through expensive post-processing or risk contract defaults. Throughout this manuscript, pre-manufacturing parameters refer to agricultural and chemical characteristics measurable during sugarcane procurement before the onset of any jaggery manufacturing activities, including soil type, water source, sugarcane variety, seasonal conditions, ratoon stage, and juice chemical composition. Hidden natural potential for golden jaggery Golden jaggery commands a premium price in the market; however, its production commonly depends on chemical interventions to achieve the desired color. In current manufacturing practice, many sugarcane batches are treated chemically because producers lack reliable methods to predict the final jaggery color before processing. Analysis of 2001 samples shows that a considerable proportion of sugarcane can naturally produce Golden jaggery when grown under suitable soil, water, and varietal conditions. Therefore, the key challenge is not the limited availability of Golden-producing sugarcane, but the inability to identify such batches at the procurement stage. As a result, manufacturers adopt conservative processing strategies that increase production costs and reduce the natural quality characteristics that are valued in premium jaggery products. Daily procurement challenge A typical manufacturer processing 6.5 metric tons receives deliveries from different suppliers with different soil-water-variety profiles. At procurement, the manufacturer cannot predict which batches will naturally produce Golden jaggery. Current practice involves mixing all batches and applying chemical treatment uniformly. However, field observations indicate that 30–50% of procured cane naturally produces Golden without intervention, yet receives unnecessary chemical treatment under blind procurement strategies. This prediction gap creates systematic economic waste while compromising the natural quality characteristics that command premium market positioning. Mechanistic basis of jaggery color formation Jaggery color formation arises from complex biochemical processes during juice concentration, involving multiple chemical constituents that interact through temperature-dependent reactions7. Table 1 summarizes the main chemical constituents and their roles in color formation mechanisms.Table 1Typical chemical composition of jaggery and influence on color formation.ComponentTypical rangeRole in color formationSucrose65–85%Primary sugar; hydrolysis products participate in Maillard reactions with amino acids7Reducing sugars10–15%Direct reactants in Maillard browning and caramelization; higher levels promote darker colors7Minerals (Fe, Mg, K, Ca)0.6–1.0%Catalyze enzymatic browning; soil-derived mineral profile affects color intensity1Proteins & Amino Acids0.4–0.8%Essential reactants for Maillard reactions; amino acid profile varies with soil nitrogen contentPhenolic compounds50–200 mg/kgSubstrates for polyphenol oxidase8; oxidation contributes to brown pigmentsMoisture content6–10%Influences reaction kinetics; water source affects dissolved mineral content Table 1Typical chemical composition of jaggery and influence on color formation.ComponentTypical rangeRole in color formationSucrose65–85%Primary sugar; hydrolysis products participate in Maillard reactions with amino acids7Reducing sugars10–15%Direct reactants in Maillard browning and caramelization; higher levels promote darker colors7Minerals (Fe, Mg, K, Ca)0.6–1.0%Catalyze enzymatic browning; soil-derived mineral profile affects color intensity1Proteins & Amino Acids0.4–0.8%Essential reactants for Maillard reactions; amino acid profile varies with soil nitrogen contentPhenolic compounds50–200 mg/kgSubstrates for polyphenol oxidase8; oxidation contributes to brown pigmentsMoisture content6–10%Influences reaction kinetics; water source affects dissolved mineral content Typical chemical composition of jaggery and influence on color formation. Soil composition is associated with variations in jaggery color through multiple biochemical pathways. Soil mineral content (Fe, Mg, K, Ca) absorbed during cultivation catalyzes enzymatic browning reactions during juice concentration, with iron-rich soils promoting darker pigmentation through polyphenol oxidase activation1,8. Soil nitrogen availability modulates amino acid profiles in sugarcane juice, which serve as essential reactants in Maillard browning reactions that generate brown color compounds during thermal processing7. Red soils and black cotton soils, prevalent in major jaggery-producing regions, exhibit distinct mineral signatures that create characteristic color profiles in finished products1. Water source characteristics show comparable associations with color variation through dissolved mineral content and pH modulation. River water typically contains lower dissolved solids compared to groundwater or borewell sources, resulting in reduced catalytic activity for browning reactions9. Water mineral composition (particularly calcium and magnesium concentrations) affects juice pH during extraction, subsequently influencing enzyme activity during concentration and the extent of caramelization reactions7. These soil-water interactions create region-specific terroir effects analogous to those documented in wine production10,11, where environmental factors fundamentally determine final product characteristics through biochemical pathway modulation rather than direct compositional effects. Multiple sugarcane varieties demonstrated significant variation in jaggery quality parameters, indicating strong genetic influence on final product characteristics. The influence of agricultural parameters on final product characteristics suggests that soil mineral composition and water quality may affect precursor availability and enzyme activity during juice extraction, subsequently influencing reaction pathways during concentration (Fig. 1).Fig. 1Conceptual framework for jaggery color formation showing the relationship between agricultural variables, chemical composition, biochemical processes, and color outcomes. Conceptual framework for jaggery color formation showing the relationship between agricultural variables, chemical composition, biochemical processes, and color outcomes. Justification for machine learning approaches The inherent complexity of these interacting biochemical pathways–involving multiple enzymes (polyphenol oxidase8, peroxidase), temperature-dependent reactions (Maillard7, caramelization), and precursor availability governed by agricultural conditions–creates a multi-dimensional prediction challenge unsuitable for simple mechanistic models. Each pathway responds non-linearly to environmental inputs, with interactions that are difficult to model explicitly. Explicit specification of every reaction pathway, enzyme kinetic parameter, and environmental interaction would require prohibitive experimental investment and computational complexity. Machine learning offers a pragmatic alternative: by learning non-linear relationships directly from observed soil-water-variety-color patterns, ML models can capture the aggregate effects of these complex biochemical interactions without requiring explicit mechanistic specification of each pathway12. This data-driven approach complements rather than replaces mechanistic understanding, using domain knowledge to guide feature selection while leveraging ML’s pattern recognition capabilities for prediction.Fig. 2Proposed machine learning architecture for jaggery color classification framework. The diagram illustrates data flow from input features through preprocessing, model training, validation, to final color classification output. Proposed machine learning architecture for jaggery color classification framework. The diagram illustrates data flow from input features through preprocessing, model training, validation, to final color classification output. Related work Recent machine learning advances12,13 have enabled precise agricultural prediction for crop monitoring, yield estimation, and disease detection. While previous studies focused on sugar yield prediction6, color classification in processed agricultural products remains underexplored. Most existing applications focus on yield prediction rather than quality attributes, and no prior work has developed machine learning models for jaggery color classification using labeled datasets6,14. Color is a critical quality attribute that strongly influences consumer preferences and pricing of food products. In jaggery production specifically, color variation from Golden yellow to Dark brown directly impacts market grading and pricing structures. Recent ML-driven color classification studies15,16 have employed hyperspectral imaging, computer vision, and spectral reflectance techniques to achieve precise grading of fruits, grains, and sugarcane-derived products. Recent machine learning studies in the sugarcane processing domain have demonstrated that sugar yield can be accurately predicted at the pre-manufacturing stage using a minimal set of chemical parameters, such as Brix and moisture content, achieving high accuracy while significantly reducing analytical complexity and cost17. Recent advances in ML-based food quality assessment have demonstrated significant progress. Deep learning approaches using convolutional neural networks achieved 96.2% accuracy in multi-class fruit color grading18, while ensemble methods combined with hyperspectral imaging improved honey color classification to 94.8%19. Transfer learning approaches have successfully adapted pre-trained models for agricultural product quality assessment, reducing training data requirements by 60%20. Explainable AI techniques using SHAP values have enabled interpretation of black-box models in food quality prediction21. However, these studies focus exclusively on post-harvest assessment rather than pre-manufacturing prediction using cultivation parameters. Existing methodological approaches Existing methodologies can be categorized into three main approaches: Spectral imaging approaches Utilize hyperspectral or multispectral imaging for post-production color classification, requiring expensive specialized equipment ($50,000+) and controlled imaging environments.Chemical assay methods Employ laboratory-based compositional analysis for detailed quality assessment but require significant resources and represent reactive approaches.Computer vision techniques Apply digital image processing for automated color grading with moderate equipment costs but depend on post-processing visual analysis.However, these post-processing approaches fail to address the fundamental challenge of predicting color outcomes before manufacturing begins. Table 2 presents a comprehensive comparison of existing approaches for agricultural product color classification, highlighting the gap in pre-manufacturing prediction capabilities.Table 2Comparison of previous agricultural product color classification studies.ReferenceProductMethodologyTimingAccuracyKey limitationsCubero et al.15Fruits & vegetablesComputer vision + SVMPost-harvest91.2%Post-harvest only; expensive equipmentUnay et al.16ApplesMultispectral imaging + MLPost-harvest89.5%Post-harvest only; controlled imagingZhang et al.18Fruits (multiclass)Deep learning (CNN)Post-harvest96.2%Post-harvest only; large dataset requiredKumar & Singh19HoneyHyperspectral imaging + MLPost-harvest94.8%Post-harvest only; lab equipmentHussain et al.9JaggeryGas pretreatment + chemicalDuring productionN/APost-production; alters productSreedevi & Madhava22JaggeryJuice pretreatment experimentsDuring productionN/ARequires processing initiationThis studyJaggeryRandom forestPre-manufacturing98.3%Single region validation Spectral imaging approaches Utilize hyperspectral or multispectral imaging for post-production color classification, requiring expensive specialized equipment ($50,000+) and controlled imaging environments. Spectral imaging approaches Utilize hyperspectral or multispectral imaging for post-production color classification, requiring expensive specialized equipment ($50,000+) and controlled imaging environments. Chemical assay methods Employ laboratory-based compositional analysis for detailed quality assessment but require significant resources and represent reactive approaches. Chemical assay methods Employ laboratory-based compositional analysis for detailed quality assessment but require significant resources and represent reactive approaches. Computer vision techniques Apply digital image processing for automated color grading with moderate equipment costs but depend on post-processing visual analysis. Computer vision techniques Apply digital image processing for automated color grading with moderate equipment costs but depend on post-processing visual analysis. Table 2Comparison of previous agricultural product color classification studies.ReferenceProductMethodologyTimingAccuracyKey limitationsCubero et al.15Fruits & vegetablesComputer vision + SVMPost-harvest91.2%Post-harvest only; expensive equipmentUnay et al.16ApplesMultispectral imaging + MLPost-harvest89.5%Post-harvest only; controlled imagingZhang et al.18Fruits (multiclass)Deep learning (CNN)Post-harvest96.2%Post-harvest only; large dataset requiredKumar & Singh19HoneyHyperspectral imaging + MLPost-harvest94.8%Post-harvest only; lab equipmentHussain et al.9JaggeryGas pretreatment + chemicalDuring productionN/APost-production; alters productSreedevi & Madhava22JaggeryJuice pretreatment experimentsDuring productionN/ARequires processing initiationThis studyJaggeryRandom forestPre-manufacturing98.3%Single region validation Comparison of previous agricultural product color classification studies. A recent study by Sreedevi and Madhava22 demonstrated that enzymatic browning significantly affects jaggery color formation, with polyphenol oxidase8 and peroxidase enzymes contributing to color darkening during processing. The pretreatment of sugarcane juice with various gases has been shown to improve color outcomes by controlling polyphenol oxidase activity; however, this approach still requires processing initiation and cannot predict outcomes from pre-cultivation parameters16,22. Research gap and objectives Identification of critical gap Despite extensive research on jaggery quality improvement1,9 and agricultural product color classification using imaging and machine learning approaches15,16,18,19, no existing framework enables reliable prediction of jaggery color prior to manufacturing using parameters measurable during sugarcane procurement6,14. Previous studies have focused exclusively on post-production chemical interventions9,22 and sugar yield prediction6, leaving color outcomes unpredictable until after processing completion. This uncertainty limits proactive quality control and informed procurement decisions, necessitating a pre-manufacturing predictive framework capable of linking cultivation-stage parameters to final jaggery color outcomes. Although pre-manufacturing prediction of sugar yield using chemical parameters has been successfully demonstrated, equivalent approaches for predicting jaggery quality attributes–particularly color–prior to processing have not yet been reported, leaving a critical gap in proactive quality management for the jaggery industry17. Novel contributions of this work While this study employs established machine learning algorithms (Random Forest, Gradient Boosting), several aspects represent genuine scientific contributions beyond routine algorithm application: Temporal paradigm shift Unlike all prior jaggery quality studies8,9,22 that focus on post-production color improvement through chemical interventions or gas pretreatment, this framework enables pre-manufacturing prediction using parameters measurable before processing begins. This temporal advantage allows proactive procurement decisions rather than reactive quality correction, representing a fundamental operational shift.Predictive associations between agricultural parameters and jaggery color The quantified demonstration that soil type and water type account for 62.9% of predictive importance raises questions about prevailing biochemical assumptions in jaggery literature1,9,14 that prioritize chemical composition as primary color determinants. This associative finding suggests the value of redirecting research attention from juice chemistry toward environmental factors, though causal attribution requires further experimental validation, opening new avenues for quality management through strategic sourcing.Practical deployment feasibility Computational efficiency analysis (0.017s prediction, 0.07 MB memory) demonstrates field-level deployment viability on standard mobile devices, contrasting with existing agricultural color classification approaches15,16,19 requiring expensive hyperspectral imaging equipment ($50K+) or laboratory infrastructure.Methodological rigor The study establishes comprehensive validation protocols (three-tier validation, learning curve analysis, statistical significance testing with Bonferroni correction, cross-model comparison) that exceed typical agricultural ML studies12,13 and provide a methodological template for future work.The contribution thus lies in: (a) establishing a new predictive paradigm (pre-manufacturing vs. post-production), (b) discovering unexpected environmental dominance over chemical factors, and (c) demonstrating practical deployment feasibility. Application novelty and algorithmic novelty represent distinct valid scientific contributions–the former advances domain knowledge while the latter advances computational methodology12,13. Temporal paradigm shift Unlike all prior jaggery quality studies8,9,22 that focus on post-production color improvement through chemical interventions or gas pretreatment, this framework enables pre-manufacturing prediction using parameters measurable before processing begins. This temporal advantage allows proactive procurement decisions rather than reactive quality correction, representing a fundamental operational shift. Temporal paradigm shift Unlike all prior jaggery quality studies8,9,22 that focus on post-production color improvement through chemical interventions or gas pretreatment, this framework enables pre-manufacturing prediction using parameters measurable before processing begins. This temporal advantage allows proactive procurement decisions rather than reactive quality correction, representing a fundamental operational shift. Predictive associations between agricultural parameters and jaggery color The quantified demonstration that soil type and water type account for 62.9% of predictive importance raises questions about prevailing biochemical assumptions in jaggery literature1,9,14 that prioritize chemical composition as primary color determinants. This associative finding suggests the value of redirecting research attention from juice chemistry toward environmental factors, though causal attribution requires further experimental validation, opening new avenues for quality management through strategic sourcing. Predictive associations between agricultural parameters and jaggery color The quantified demonstration that soil type and water type account for 62.9% of predictive importance raises questions about prevailing biochemical assumptions in jaggery literature1,9,14 that prioritize chemical composition as primary color determinants. This associative finding suggests the value of redirecting research attention from juice chemistry toward environmental factors, though causal attribution requires further experimental validation, opening new avenues for quality management through strategic sourcing. Practical deployment feasibility Computational efficiency analysis (0.017s prediction, 0.07 MB memory) demonstrates field-level deployment viability on standard mobile devices, contrasting with existing agricultural color classification approaches15,16,19 requiring expensive hyperspectral imaging equipment ($50K+) or laboratory infrastructure. Practical deployment feasibility Computational efficiency analysis (0.017s prediction, 0.07 MB memory) demonstrates field-level deployment viability on standard mobile devices, contrasting with existing agricultural color classification approaches15,16,19 requiring expensive hyperspectral imaging equipment ($50K+) or laboratory infrastructure. Methodological rigor The study establishes comprehensive validation protocols (three-tier validation, learning curve analysis, statistical significance testing with Bonferroni correction, cross-model comparison) that exceed typical agricultural ML studies12,13 and provide a methodological template for future work. Methodological rigor The study establishes comprehensive validation protocols (three-tier validation, learning curve analysis, statistical significance testing with Bonferroni correction, cross-model comparison) that exceed typical agricultural ML studies12,13 and provide a methodological template for future work. Research questions This study addresses three fundamental research questions: RQ1: Can machine learning algorithms accurately predict jaggery color categories (Golden, Light brown, Dark brown) from pre-processing agricultural and chemical parameters? RQ2: Which combination of agricultural factors and chemical composition parameters provides the optimal predictive capability for jaggery color classification? RQ3: What are the characteristics of computational efficiency and practical deployment requirements for industrial implementation? Primary contributions This research provides three fundamental contributions based on analysis of 2001 sugarcane samples from four commercial varieties across three harvest seasons in the Erode region of Tamil Nadu: Development of a machine learning framework for pre-manufacturing jaggery color classification using cultivation parameters, achieving 98.3% test accuracy.Quantitative identification of soil type and water type as the strongest predictive associations within this regional observational dataset (62.93% combined importance), with soil type (41.44%) and water type (21.49%) contributing the largest shares of feature importance.Demonstration of industrial implementation feasibility through computational efficiency analysis (0.017s prediction time, 0.07 MB memory footprint enabling mobile device deployment). Development of a machine learning framework for pre-manufacturing jaggery color classification using cultivation parameters, achieving 98.3% test accuracy. Development of a machine learning framework for pre-manufacturing jaggery color classification using cultivation parameters, achieving 98.3% test accuracy. Quantitative identification of soil type and water type as the strongest predictive associations within this regional observational dataset (62.93% combined importance), with soil type (41.44%) and water type (21.49%) contributing the largest shares of feature importance. Quantitative identification of soil type and water type as the strongest predictive associations within this regional observational dataset (62.93% combined importance), with soil type (41.44%) and water type (21.49%) contributing the largest shares of feature importance. Demonstration of industrial implementation feasibility through computational efficiency analysis (0.017s prediction time, 0.07 MB memory footprint enabling mobile device deployment). Demonstration of industrial implementation feasibility through computational efficiency analysis (0.017s prediction time, 0.07 MB memory footprint enabling mobile device deployment). Materials and methods Dataset collection and preparation This research utilized the “Sugarcane Properties and Jaggery Production Analysis Dataset” maintained by Dr. Senthilkumar on Mendeley Data. The authors obtained access through a private sharing arrangement with a unique access credential provided by the dataset custodian. The dataset remains under restricted access on Mendeley Data and is not publicly available through a DOI, as confidentiality agreements with participating production units and sugarcane farmers preclude open distribution. Interested researchers may request access for academic and non-commercial purposes through the corresponding author (ilayaraja.v@vit.ac.in), who will coordinate with the dataset custodian, Dr. Senthilkumar, subject to approval. This controlled access approach ensures data confidentiality while maintaining scientific transparency. The dataset encompasses sugarcane samples from diverse production facilities across the Erode region of Tamil Nadu, India, collected during three harvest seasons (2023–2024). The dataset includes four major commercial sugarcane varieties: Co 86032, Co 11015, Pi 1110, and Co 86027, selected based on their regional prevalence and commercial significance, consistent with the varieties used in related ML-based sugarcane quality studies6. The original dataset comprised 13 features encompassing agricultural parameters, chemical composition measurements, and target jaggery color classifications. Quality control measures included standardized sampling protocols, certified analytical methods for chemical measurements, and expert visual assessment for color classification by experienced jaggery manufacturers. The complete source code used in this study is publicly available at Zenodo (10.5281/zenodo.20039598). Color categories were defined as Golden (premium quality, 33.8% of samples), Light brown (standard quality, 40.5% of samples), and Dark brown (lower grade, 25.7% of samples) based on established market grading standards used across Indian jaggery markets1,4. Jaggery color classification in the dataset was initially assigned by experienced jaggery manufacturers and production workers at each manufacturing unit based on their practical knowledge of commercial color grading standards. These workers routinely classify jaggery color as part of daily production and market pricing operations, applying traditional grading criteria developed through years of hands-on manufacturing experience. The classifications were subsequently verified during field visits under standardized natural daylight conditions (between 10 AM and 2 PM). The verification process involved independent visual assessment of jaggery samples against the three established market categories: Golden (bright, light golden-yellow appearance), Light brown (honey-brown appearance), and Dark brown (deeper, dark amber-brown appearance). In all cases, the researcher’s independent assessment agreed with the manufacturer-assigned color classifications, indicating high consistency between experienced industry practitioners and the research team for these visually distinct commercial grades. It should be noted that the jaggery color labels were assigned based on expert visual assessment by experienced practitioners. Although consistency between practitioners and the research team was observed, no formal inter-rater reliability statistics (e.g., Cohen’s Kappa) were computed, and no instrumental colorimetric validation (e.g., CIE L*a*b*) was performed. Accordingly, the model predicts expert-defined categorical grading outcomes consistent with practical industry assessment rather than instrumentally quantified colorimetric values. Despite these limitations, expert visual grading reflects standard industrial practice in decentralized jaggery production systems, where quality assessment and market pricing are routinely based on human visual inspection rather than laboratory instrumentation. Therefore, the labels used in this study represent operational grading criteria relevant to real-world decision-making rather than standardized physicochemical measurements. The objective of this study is not to predict absolute colorimetric values, but to model practical classification outcomes relevant to stakeholders in the jaggery supply chain. In this context, the model learns patterns associated with expert-defined categories that directly influence economic valuation. Nevertheless, the absence of quantitative color measurement and formal inter-rater agreement introduces subjectivity in the target variable. Future work will focus on integrating instrumental colorimetric analysis and statistical agreement measures to enhance label standardization and improve predictive robustness. Instrumental color measurement was not feasible during field collection due to the lack of portable devices and the rapid color changes observed during storage and transport under ambient conditions. Dataset features description The comprehensive dataset encompasses 13 input features strategically selected to capture the multi-dimensional factors influencing jaggery color formation. These features span three critical domains: location-specific parameters, agricultural cultivation conditions, and chemical composition measurements. Table 3 provides detailed specifications for each feature, including data types, value ranges, and descriptive information essential for understanding the predictive framework. The feature selection strategy prioritizes parameters measurable during pre-manufacturing stages, enabling proactive quality prediction rather than reactive assessment. Location parameters capture regional terroir effects within the Erode district, while agricultural parameters encompass soil characteristics, water sources, cultivation practices, varietal selection, and seasonal influences. Chemical parameters represent standard sugarcane juice composition measurements obtained through established analytical protocols, providing quantitative indicators of juice quality at harvest. This feature architecture enables systematic analysis of environmental terroir dominance versus chemical composition effects in jaggery color determination, addressing the fundamental research question of which parameter categories provide optimal predictive capability for industrial deployment.Table 3Complete feature descriptions for jaggery color classification dataset.Feature nameTypeUnit/RangeDescriptionLocation parameter (n = 2) LocationCategorical19 classesMuniyappampalayam, Anthiyur, Olagadam, Appakudal, Bhavani, etc. Unit TypeCategorical2 classesFarmer Unit, Private UnitAgricultural parameters (n = 5) Soil typeCategorical3 classesRed Soil, Alluvial Soil, Black Soil Water typeCategorical4 classesCanal Water, River Water, Groundwater, Borewell Water Ratoon typeCategorical4 classesPlant Crop, First Ratoon, Second Ratoon, Third Ratoon Cane varietyCategorical4 classesCo 86032, Co 11015, Pi 1110, Co 86027 SeasonCategorical3 classesSummer Season, Rain Season, Winter SeasonChemical parameters (n = 6) Cane juice weight (kg/ton)Continuous579–736.4Weight of extracted juice per ton of cane Brix valueContinuous15.0–26.0°BxTotal soluble solids PolContinuous9.53–18.97%Apparent sucrose content Reducing sugar (%)Continuous1.5–5.2%Glucose + fructose content Non-sugar content (%)Continuous1.45–4.03%Non-sucrose solids Water content (%)Continuous74.0–85.0%Moisture in fresh juiceTarget variable Jaggery colorCategorical3 classesGolden, Light brown, Dark brown Table 3Complete feature descriptions for jaggery color classification dataset.Feature nameTypeUnit/RangeDescriptionLocation parameter (n = 2) LocationCategorical19 classesMuniyappampalayam, Anthiyur, Olagadam, Appakudal, Bhavani, etc. Unit TypeCategorical2 classesFarmer Unit, Private UnitAgricultural parameters (n = 5) Soil typeCategorical3 classesRed Soil, Alluvial Soil, Black Soil Water typeCategorical4 classesCanal Water, River Water, Groundwater, Borewell Water Ratoon typeCategorical4 classesPlant Crop, First Ratoon, Second Ratoon, Third Ratoon Cane varietyCategorical4 classesCo 86032, Co 11015, Pi 1110, Co 86027 SeasonCategorical3 classesSummer Season, Rain Season, Winter SeasonChemical parameters (n = 6) Cane juice weight (kg/ton)Continuous579–736.4Weight of extracted juice per ton of cane Brix valueContinuous15.0–26.0°BxTotal soluble solids PolContinuous9.53–18.97%Apparent sucrose content Reducing sugar (%)Continuous1.5–5.2%Glucose + fructose content Non-sugar content (%)Continuous1.45–4.03%Non-sucrose solids Water content (%)Continuous74.0–85.0%Moisture in fresh juiceTarget variable Jaggery colorCategorical3 classesGolden, Light brown, Dark brown Complete feature descriptions for jaggery color classification dataset. Dataset validation context The samples utilized in this study were previously validated for spatial generalizability across 18 locations within Erode district through Leave-One-Location-Out Cross-Validation (LOLO-CV), achieving mean R\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$^2$$\end{document} = 94.80% with SD = 0.0221 in sugar yield prediction tasks17. While both studies share the same sample population, they address independent prediction objectives: sugar yield regression (continuous target, 2 chemical parameters) versus color classification (categorical target, 13 pre-manufacturing parameters). This multi-task approach demonstrates that measured parameters capture multiple orthogonal quality dimensions, with regression requiring continuous numerical relationships and classification demanding categorical boundary discrimination. Machine learning architecture for model development The overall machine learning framework is depicted in Fig. 2. The input data included a well-distributed set of agronomic and chemical features collected from sugarcane plants grown across multiple varieties and seasons. Pre-processing involved imputation of missing values, encoding categorical variables, and scaling input features, followed by splitting the data into training (70%) and testing (30%) sets using 10-fold cross-validation to ensure robustness. Data pre-processing and feature engineering Data quality assessment Quality control verification confirmed complete data coverage across all 13 features, with no missing values detected in any of the 2001 samples. The preprocessing pipeline included systematic missing value handling procedures as a precautionary measure following machine learning best practices: median imputation for continuous variables (Brix value, Pol content, reducing sugar percentage, water content) and mode imputation for categorical variables (soil type, water type, variety, season, ratoon stage). However, no imputation was required as all features contained complete observations across the dataset. No outlier removal was performed to preserve natural data variability encountered in commercial operations. All categorical features underwent systematic encoding using scikit-learn’s LabelEncoder, with the target variable encoding mapping Dark brown (0), Golden (1), and Light brown (2) to preserve ordinal quality relationships. While one-hot encoding is typically preferred for nominal variables to avoid imposing ordinal relationships, LabelEncoder was selected for this study due to specific advantages in tree-based ensemble methods. Decision trees and Random Forests naturally handle integer-encoded categorical variables by learning optimal split points without assuming ordinality. This approach: (1) reduces feature space dimensionality (13 features vs. 32 with one-hot encoding for our categorical variables), (2) maintains computational efficiency during training and prediction, (3) prevents feature space fragmentation that can occur with high-cardinality categorical variables such as Location (19 classes). Validation experiments confirmed that model performance remained stable across encoding strategies (accuracy difference <0.3% between LabelEncoder and one-hot encoding), while LabelEncoder provided superior computational efficiency (71% faster training time) without sacrificing prediction quality. This encoding strategy is particularly suitable for tree-based algorithms, which represent the primary modeling approach in this study.To prevent data leakage during cross-validation, a rigorous pipeline architecture was implemented by combining the StandardScaler pre-processing and classification stages. Continuous features were standardized using z-score normalization within cross-validation folds, ensuring that scaling parameters were fitted only on the training data and applied to the validation data. Hyperparameter selection and sensitivity analysis Table 4 summarizes the hyperparameter configurations for all evaluated algorithms. Hyperparameters were selected using conservative settings informed by established best practices for tree-based ensemble methods, prioritizing generalization over training-set performance. The selected configurations were validated through sensitivity analysis using 5-fold stratified cross-validation on the training set, confirming that conservative parameterization achieved equivalent performance to more complex configurations (e.g., n_estimators=200 with unlimited depth yielded identical CV accuracy to the selected n_estimators=50, max_depth=10). For the Neural Network and SVM models, fixed hyperparameters were adopted rather than conducting extensive grid search, as these models were primarily included as baseline comparisons. Hyperparameter search space Hyperparameter search spaces were defined as follows. For Random Forest and Extra Trees, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$n_{\text {estimators}} \in \{25, 50, 75, 100, 200\},$$\end{document} \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$max_{\text {depth}} \in \{5, 8, 10, 15, \text {None}\},$$\end{document} \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$min_{\text {samples\_split}}$$\end{document}\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\in \{2, 5, 10, 20\},$$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$min_{\text {samples\_leaf}} \in \{1, 2, 4, 8\}.$$\end{document} For Gradient Boosting, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$n_{\text {estimators}}$$\end{document}\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\in \{ 25,\;$$\end{document}\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$50,\;100\} ,$$\end{document} \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$learning_{\text {rate}}$$\end{document} \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\in \{0.01, 0.05, 0.10\},$$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$max_{\text {depth}} \in \{3, 5\}.$$\end{document} For the Neural Network, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathrm{hidden}}\_{\mathrm{layer}}$$\end{document}\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\_{\mathrm{sizes}} = (32,),$$\end{document} α = 0.01, learning_rate = adaptive, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$max\_iter = 500.$$\end{document} For SVM, C = 0.1, kernel = rbf, and gamma = scale. Conservative configurations within these ranges were selected based on 5-fold stratified cross-validation performance on the training set, with preference given to simpler parameterizations when performance differences were negligible. All models used 70/30 train-test split with random_state=42 for reproducibility and 10-fold stratified cross-validation for performance assessment.Table 4Summary of machine learning models, hyperparameters, and selection rationale.AlgorithmParadigmKey parametersRationale for selectionRandom forestEnsemble (Bagging)n_estimators=50max_depth=10min_samples_split=10min_samples_leaf=4Robust to overfitting through bootstrap aggregation; handles mixed categorical and continuous features effectivelyGradient boostingEnsemble (Boosting)n_estimators=50learning_rate=0.05max_depth=3min_samples_split=10Sequential error correction minimizes bias; adaptive learning captures complex patternsExtra treesEnsemble (Random)n_estimators=75max_depth=8min_samples_split=10min_samples_leaf=4Increased randomization reduces variance; faster trainingNeural networkMulti-layer perceptronhidden_layers=(32)alpha=0.01learning_rate=’adaptive’max_iter=500Captures non-linear patterns through hierarchical representationsSVMKernel-basedC=0.1kernel=’rbf’gamma=’scale’probability=TrueMargin maximization with theoretical foundation; serves as benchmark for comparison Table 4Summary of machine learning models, hyperparameters, and selection rationale.AlgorithmParadigmKey parametersRationale for selectionRandom forestEnsemble (Bagging)n_estimators=50max_depth=10min_samples_split=10min_samples_leaf=4Robust to overfitting through bootstrap aggregation; handles mixed categorical and continuous features effectivelyGradient boostingEnsemble (Boosting)n_estimators=50learning_rate=0.05max_depth=3min_samples_split=10Sequential error correction minimizes bias; adaptive learning captures complex patternsExtra treesEnsemble (Random)n_estimators=75max_depth=8min_samples_split=10min_samples_leaf=4Increased randomization reduces variance; faster trainingNeural networkMulti-layer perceptronhidden_layers=(32)alpha=0.01learning_rate=’adaptive’max_iter=500Captures non-linear patterns through hierarchical representationsSVMKernel-basedC=0.1kernel=’rbf’gamma=’scale’probability=TrueMargin maximization with theoretical foundation; serves as benchmark for comparison Summary of machine learning models, hyperparameters, and selection rationale. n_estimators=50 max_depth=10 min_samples_split=10 min_samples_leaf=4 n_estimators=50 learning_rate=0.05 max_depth=3 min_samples_split=10 n_estimators=75 max_depth=8 min_samples_split=10 min_samples_leaf=4 hidden_layers=(32) alpha=0.01 learning_rate=’adaptive’ max_iter=500 C=0.1 kernel=’rbf’ gamma=’scale’ probability=True Experimental design Three-tier validation strategy Model evaluation employed a rigorous three-tier validation approach to ensure generalization and prevent overfitting: Tier 1—Training set optimization (70%, n = 1400): Hyperparameters were carefully selected using conservative settings to prevent overfitting, with choices informed by best practices and domain knowledge: Random Forest (n_estimators = 50, max_depth = 10, min_samples_split = 10), Gradient Boosting (n_estimators = 50, learning_rate = 0.05, max_depth = 3). All models used 10-fold stratified cross-validation for performance evaluation, ensuring no test set information influenced model configuration. Tier 2—Cross-validation assessment (10-fold CV): Independent 10-fold stratified cross-validation on the training set (n = 1400) was performed to quantify model stability and variance. Tier 3—Held-out test set evaluation (30%, n = 601): Final model performance assessed on completely unseen test data. This constitutes true independent validation: the test set was created at initial data split, isolated throughout all development activities, never accessed during training, never used for hyperparameter optimization, and used exactly once for final evaluation. This test set was stratified by jaggery color class (Golden: 33.8%, Light brown: 40.5%, Dark brown: 25.7%) and temporally distributed across all three seasons to ensure representative evaluation. All performance metrics in Table 6 represent evaluation on this completely independent held-out set. This independent validation set enables assessment of generalization performance without overfitting. The test set was stratified by jaggery color class (Golden: 33.8%, Light brown: 40.5%, Dark brown: 25.7%) and temporally distributed across all three seasons (Winter, Summer, Monsoon) to ensure representative evaluation across diverse production conditions. Cross-validation predictions were generated using cross_val_predict with method = “predict” for classification metrics and method = “predict_proba” for probability-based evaluation. Fixed random_state = 42 ensured reproducibility across all experiments. Performance evaluation The performance assessment utilized weighted averaging to account for class imbalance. The primary metrics included accuracy (overall classification correctness), precision and recall (weighted averages using zero_division = 0), and F1-score (harmonic mean of precision and recall). Precision-Recall Area Under Curve (PR-AUC) was computed using label_binarize transformation with weighted averaging. PR-AUC was selected over ROC-AUC because: (1) the dataset exhibits moderate class imbalance (balance ratio = 0.636), where PR-AUC provides more informative assessment; (2) PR-AUC is more sensitive to precision-recall trade-offs for imbalanced scenarios; (3) in industrial deployment, correctly identifying premium Golden jaggery has higher practical importance, making precision-recall metrics more relevant than true-negative rates emphasized by ROC-AUC. Performance metrics mathematical formulations: The following evaluation metrics were computed to assess model performance: Accuracy: Overall classification correctness across all classes1\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \text {Accuracy} = \frac{TP + TN}{TP + TN + FP + FN} \end{aligned}$$\end{document}Precision: Proportion of correct positive predictions2\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \text {Precision} = \frac{TP}{TP + FP} \end{aligned}$$\end{document}Recall (Sensitivity): Proportion of actual positives correctly identified3\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \text {Recall} = \frac{TP}{TP + FN} \end{aligned}$$\end{document}F1-Score: Harmonic mean balancing precision and recall4\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \text {F1-Score} = 2 \times \frac{\text {Precision} \times \text {Recall}}{\text {Precision} + \text {Recall}} \end{aligned}$$\end{document}Specificity: Proportion of actual negatives correctly identified5\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \text {Specificity} = \frac{TN}{TN + FP} \end{aligned}$$\end{document}Precision-Recall AUC: Area under the precision-recall curve computed through trapezoidal integration6\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \text {PR-AUC} = \int\limits_{0}^{1} \text {Precision}(r) \, dr \end{aligned}$$\end{document}where TP = True Positives, TN = True Negatives, FP = False Positives, FN = False Negatives. For multi-class classification, weighted averaging was applied based on class support to account for class imbalance. Cohen’s Kappa coefficient (κ) was computed to assess classification agreement adjusted for chance occurrence:7\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \kappa = \frac{p_o - p_e}{1 - p_e} \end{aligned}$$\end{document}where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$p_o$$\end{document} represents observed agreement (equivalent to overall accuracy), and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$p_e$$\end{document} denotes expected agreement by chance, calculated as \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$p_e = \sum _{i=1}^{k} p_i^2$$\end{document}, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$p_i$$\end{document} is the proportion of samples in class i. For the three-class jaggery dataset (Golden=33.8%, Light Brown=40.5%, Dark Brown=25.7%), \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$p_e$$\end{document} = 0.3443. Kappa values were interpreted using Landis and Koch23 guidelines: κ < 0.00 (poor), 0.00-0.20 (slight), 0.21-0.40 (fair), 0.41-0.60 (moderate), 0.61-0.80 (substantial), 0.81-1.00 (almost perfect). Statistical significance testing Statistical significance of performance differences was evaluated using Friedman test24 for multiple related samples, comparing accuracy scores across cross-validation folds. Pairwise model comparisons employed paired t-tests on fold-level accuracy scores with Bonferroni correction for multiple comparison adjustment. Bootstrap confidence intervals (95% confidence level) were computed using 1000 bootstrap samples for robust uncertainty quantification (Table 8). Statistical test assumptions and corrections Bonferroni correction was selected to maintain strict family-wise error rate control (α = 0.05 divided by number of comparisons) across multiple pairwise model comparisons. Normality of fold-level accuracy distributions was verified using Shapiro-Wilk tests (p > 0.05 for all ensemble models), confirming suitability for parametric paired t-tests. Identical stratified folds (random_state=42) were maintained across all models to ensure fair statistical comparison and eliminate fold-based variance as a confounding factor. Computational complexity analysis All experiments were conducted on Intel Core i7-11800H CPU @ 2.30GHz (8 cores), 16GB DDR4 RAM, Windows 10, Python 3.12.7, and scikit-learn 1.6.1. Training and prediction times were measured using Python’s \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$time.perf_counter()$$\end{document}, with memory usage monitored via psutil 5.8.0. Measurements represent mean values over 10 independent runs with standard deviations < 5%. Theoretical complexity analysis confirmed that tree-based ensemble methods exhibit \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$O(k \cdot d \cdot n \cdot \log n)$$\end{document} training complexity and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$O(k \cdot \log n)$$\end{document} prediction complexity (Table 5).Table 5Cross-validation results with statistical confidence (10-fold CV).ModelCV accuracyCV precisionCV recall95% CI (Accuracy)Random forest0.986 ± 0.0120.986 ± 0.0120.986 ± 0.012[0.978, 0.993]Gradient boosting0.988 ± 0.0120.988 ± 0.0110.988 ± 0.012[0.981, 0.995]Extra trees0.98 ± 0.0130.98 ± 0.0130.98 ± 0.013[0.975, 0.991]Neural network0.980 ± 0.0110.980 ± 0.0110.980 ± 0.011[0.973, 0.987]SVM0.704 ± 0.0130.689 ± 0.1130.704 ± 0.013[0.697, 0.712] Table 5Cross-validation results with statistical confidence (10-fold CV).ModelCV accuracyCV precisionCV recall95% CI (Accuracy)Random forest0.986 ± 0.0120.986 ± 0.0120.986 ± 0.012[0.978, 0.993]Gradient boosting0.988 ± 0.0120.988 ± 0.0110.988 ± 0.012[0.981, 0.995]Extra trees0.98 ± 0.0130.98 ± 0.0130.98 ± 0.013[0.975, 0.991]Neural network0.980 ± 0.0110.980 ± 0.0110.980 ± 0.011[0.973, 0.987]SVM0.704 ± 0.0130.689 ± 0.1130.704 ± 0.013[0.697, 0.712] Cross-validation results with statistical confidence (10-fold CV). Results Overall model performance Table 6 presents the comprehensive performance metrics for all evaluated classification algorithms on the held-out test set. Random Forest and Gradient Boosting achieved identical superior performance with 98.3% test accuracy, demonstrating exceptional classification capability for jaggery color classification, which aligns with the recent advances in ML-based food quality assessment14.Fig. 3Confusion matrix of the Random Forest classifier for jaggery color prediction (Dark brown, Golden, Light brown). The model achieved a test accuracy of 98.34% and cross-validation accuracy of 98.57% (n=601). Dark brown samples were classified with 100% recall (155/155), Golden with 99.5% recall (202/203), and Light brown with 96.3% recall (234/243).Table 6Performance metrics of classification models on test set.ModelAccuracyPrecisionRecallF1-scorePR-AUCSpecificityCohen’s κRandom forest0.98340.98390.98340.98340.99360.99170.9747Gradient boosting0.98340.98390.98340.98340.99430.99170.9747Extra trees0.98170.98220.98170.98170.99440.99080.9721Neural network0.97840.97850.97840.97840.99550.98860.9670SVM0.71210.74080.71210.61960.91110.84320.5385Bold values indicate the highest Cohen's Kappa (κ) scores achieved among all evaluated classification models,denoting superior chance-corrected classification agreement. Confusion matrix of the Random Forest classifier for jaggery color prediction (Dark brown, Golden, Light brown). The model achieved a test accuracy of 98.34% and cross-validation accuracy of 98.57% (n=601). Dark brown samples were classified with 100% recall (155/155), Golden with 99.5% recall (202/203), and Light brown with 96.3% recall (234/243). Table 6Performance metrics of classification models on test set.ModelAccuracyPrecisionRecallF1-scorePR-AUCSpecificityCohen’s κRandom forest0.98340.98390.98340.98340.99360.99170.9747Gradient boosting0.98340.98390.98340.98340.99430.99170.9747Extra trees0.98170.98220.98170.98170.99440.99080.9721Neural network0.97840.97850.97840.97840.99550.98860.9670SVM0.71210.74080.71210.61960.91110.84320.5385Bold values indicate the highest Cohen's Kappa (κ) scores achieved among all evaluated classification models,denoting superior chance-corrected classification agreement. Performance metrics of classification models on test set. Bold values indicate the highest Cohen's Kappa (κ) scores achieved among all evaluated classification models,denoting superior chance-corrected classification agreement. Both Random Forest and Gradient Boosting achieved 98.39% precision and 98.34% recall, with identical F1-scores of 98.34%. Extra Trees achieved competitive performance with 98.17% accuracy, followed by the Neural Network at 97.84%. SVM demonstrated significantly lower performance at 71.21% accuracy, indicating poor suitability for this multiclass agricultural classification task. Figure 3 presents the confusion matrix for the Random Forest, demonstrating exceptional classification accuracy across all color categories with minimal misclassifications. Detailed examination of misclassification patterns reveals important insights into classification boundaries. Of the 601 test samples, 10 samples (1.66%) were misclassified: 1 Golden sample was classified as Dark brown and 9 Light brown samples were classified as Golden. These misclassifications occurred at biochemical boundary conditions where samples exhibited intermediate chemical profiles at the interface between discrete color categories defined by expert assessment. No misclassifications occurred between Dark brown and Golden categories, confirming that these represent distinctly separable quality tiers with clear agricultural and biochemical signatures (Fig. 4).Fig. 4Precision-recall curves—Random forest classifier. Performance across three jaggery color categories showing Dark brown (AP=1.000), Golden (AP=0.994), Light brown (AP=0.990), with micro-average (AP=0.994) and macro-average (AP=0.995). Precision-recall curves—Random forest classifier. Performance across three jaggery color categories showing Dark brown (AP=1.000), Golden (AP=0.994), Light brown (AP=0.990), with micro-average (AP=0.994) and macro-average (AP=0.995). Per-class performance analysis Table 7 presents a detailed per-class analysis for Random Forest, revealing exceptional classification capability across all jaggery color categories. The Dark brown jaggery achieved the highest precision of 99.36% with perfect recall (100.00%), resulting in an F1-score of 99.68%. Golden jaggery demonstrated 95.73% precision with 99.51% recall, while Light brown achieved perfect precision (100.00%) with 96.30% recall.Table 7Per-class performance metrics for random forest.ClassPrecisionRecallF1-scoreSpecificitySupportDark brown0.9941.0000.9970.998155Golden0.9570.9950.9760.977203Light brown1.0000.9630.9811.000243Macro average0.9840.9860.9850.992601Weighted average0.9840.980.980.992601 Table 7Per-class performance metrics for random forest.ClassPrecisionRecallF1-scoreSpecificitySupportDark brown0.9941.0000.9970.998155Golden0.9570.9950.9760.977203Light brown1.0000.9630.9811.000243Macro average0.9840.9860.9850.992601Weighted average0.9840.980.980.992601 Per-class performance metrics for random forest. Cross-validation analysis Cross-validation analysis demonstrated exceptional model stability with narrow confidence intervals (Table 5). Gradient Boosting achieved the highest cross-validation accuracy of 98.79% ± 1.15% with 95% confidence interval [98.07%, 99.50%]. Random Forest recorded 98.57% ± 1.20% cross-validation accuracy with confidence interval [97.83%, 99.31%].The minimal difference between the cross-validation and test performance for the top-performing models confirmed robust generalization without overfitting. Figure 5 illustrates the comparison between cross-validation and test set accuracy, demonstrating the robust generalization capabilities of the top-performing models.Fig. 5Cross-validation versus test set accuracy comparison. Model generalization capabilities demonstrated through minimal differences between CV and test performance (Random Forest: 0.23%, Gradient Boosting: 0.45%), confirming robust generalization without overfitting. Cross-validation versus test set accuracy comparison. Model generalization capabilities demonstrated through minimal differences between CV and test performance (Random Forest: 0.23%, Gradient Boosting: 0.45%), confirming robust generalization without overfitting. Learning curve analysis The learning curves presented in Fig. 9 provide additional validation against overfitting concerns. Random Forest demonstrated excellent convergence characteristics with a minimal gap between training and validation performance across different training set sizes, indicating a robust generalization capability. The validation curve closely followed the training curve without significant divergence, confirming that the model learned genuine patterns rather than memorizing the training data. In contrast, the SVM learning curve shows persistent gaps between the training and validation performance, explaining its poor classification results (71.21% accuracy). The Random Forest learning curve validated that our high accuracy reflects legitimate pattern recognition rather than model overfitting, supporting the reliability of our 98.3% test accuracy claims. Notably, validation performance stabilized at approximately 600–800 training samples, beyond which additional data yielded marginal improvement. This convergence behaviour empirically supports the recommendation of a minimum of 500 samples for regional pilot testing and 500 to 800 samples for full model retraining in new deployment regions. Statistical significance validation The Friedman test yielded highly significant results (\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\chi ^2$$\end{document} = 31.68, p < 0.0001), confirming meaningful performance variations among classification algorithms across cross-validation folds (Table 8). Pairwise t-tests revealed that Random Forest significantly outperformed Extra Trees (p = 0.0368), SVM (p < 0.0001), and Neural Network (p = 0.0224), while showing no significant difference from Gradient Boosting (p = 0.1934).Table 8Statistical significance tests with bootstrap validation.Statistical testStatisticp-valueSignificanceDescriptionFriedman test\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\chi ^2 = 31.685$$\end{document}< 0.001YesMultiple-model comparison across CV foldsPairwise comparisons (Bonferroni corrected) RF versus Gradient boostingt = -1.410.193NoExploratory pairwise comparison RF versus Extra treest = 2.450.037YesExploratory pairwise comparison RF versus SVMt = 78.98< 0.001YesExploratory pairwise comparison RF versus Neural networkt = 2.750.022YesExploratory pairwise comparisonBootstrap validation Bootstrap validation (RF)Mean = 98.3%95% CIRobust1000 bootstrap iterations confirm stability Prediction confidenceMean = 85.3%Std = 10.5%Moderate-highModel certainty in classifications Table 8Statistical significance tests with bootstrap validation.Statistical testStatisticp-valueSignificanceDescriptionFriedman test\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\chi ^2 = 31.685$$\end{document}< 0.001YesMultiple-model comparison across CV foldsPairwise comparisons (Bonferroni corrected) RF versus Gradient boostingt = -1.410.193NoExploratory pairwise comparison RF versus Extra treest = 2.450.037YesExploratory pairwise comparison RF versus SVMt = 78.98< 0.001YesExploratory pairwise comparison RF versus Neural networkt = 2.750.022YesExploratory pairwise comparisonBootstrap validation Bootstrap validation (RF)Mean = 98.3%95% CIRobust1000 bootstrap iterations confirm stability Prediction confidenceMean = 85.3%Std = 10.5%Moderate-highModel certainty in classifications Statistical significance tests with bootstrap validation. While the Friedman test confirmed statistically significant performance differences (p < 0.001), the practical effect size between top-performing models warrants consideration. The difference between Random Forest (98.3%) and Extra Trees (98.17%) represents only 0.17 percentage points, suggesting comparable real-world performance for industrial applications. In contrast, the substantial effect size versus SVM (27.13 percentage points) confirms fundamental algorithmic suitability differences for this classification task.Cohen’s Kappa analysis provides additional validation of classification robustness beyond simple accuracy metrics. Random Forest and Gradient Boosting both achieved κ = 0.9747, indicating “almost perfect” agreement according to Landis and Koch23 interpretation guidelines. Extra Trees (κ = 0.9721) and Neural Network (κ = 0.9671) also demonstrated almost perfect agreement, while SVM showed moderate agreement (κ = 0.5385). These Kappa values substantially exceed the threshold for substantial agreement (κ > 0.80), confirming that classification performance reflects genuine pattern recognition rather than chance agreement. This is particularly important given the three-class imbalanced structure of the dataset (Golden = 33.8%, Light Brown = 40.5%, Dark Brown = 25.7%), where high accuracy alone could potentially result from biased predictions toward the majority class. The high Kappa values across top-performing models validate that predictions are well-distributed across all three color categories. Bootstrap validation and prediction confidence analysis To address potential overfitting concerns and validate model stability, bootstrap resampling analysis was conducted using 1000 bootstrap samples with replacement from the test set (Table 9). Bootstrap resampling on the independent test set (1000 iterations) yielded a mean accuracy of 98.32% with a 95% confidence interval of [97.17%, 99.17%], confirming robust and stable generalization. Gradient Boosting demonstrated similar stability with comparable bootstrap metrics. The confidence intervals and minimal standard deviations (0.52%) confirm consistent model performance without overfitting. Prediction confidence analysis revealed moderate-to-high model certainty with mean predicted probability of 85.3% ± 10.5% for assigned classes. The confidence distribution reflects the inherent uncertainty in predicting categorical color outcomes from continuous environmental and chemical variables, which is expected in agricultural classification tasks where class boundaries represent discrete categorizations of continuous quality spectra. Bootstrap resampling with 1000 iterations confirms robust model stability. The confidence interval width of approximately 2.0% and standard deviations of 0.52% indicate consistent performance across diverse data samples without overfittingTable 9Bootstrap validation results for ensemble models (n=601, 1000 iterations, 95% CI).ModelTest accuracy (%)Bootstrap mean (%)Bootstrap 95% CIStd dev (%)F1-score (%)PR-AUC (%)Random forest98.398.32[97.17%, 99.17%]0.5298.399.36Gradient boosting98.398.32[97.17%, 99.17%]0.5298.399.36Table 10Feature importance rankings across top-performing models (All 13 Input Features).FeatureRandom forest (%)Gradient boosting (%)CategoryRankSoil type41.4440.31Agricultural1Water type21.4942.15Agricultural2Brix value11.369.58Chemical3Water content8.237.94Chemical4Reducing sugar %5.130.00Chemical5Pol content3.610.00Chemical6Cane juice weight2.180.00Chemical7Non-sugar content1.990.01Chemical8Season1.590.01Temporal9Location1.310.01Location10Cane variety0.790.00Agricultural11Ratoon type0.600.00Agricultural12Unit type0.270.00Operational13Agricultural subtotal64.3282.45––Chemical subtotal32.5117.52––Other subtotal3.180.02––Total100.00100.00–– Table 9Bootstrap validation results for ensemble models (n=601, 1000 iterations, 95% CI).ModelTest accuracy (%)Bootstrap mean (%)Bootstrap 95% CIStd dev (%)F1-score (%)PR-AUC (%)Random forest98.398.32[97.17%, 99.17%]0.5298.399.36Gradient boosting98.398.32[97.17%, 99.17%]0.5298.399.36 Bootstrap validation results for ensemble models (n=601, 1000 iterations, 95% CI). Table 10Feature importance rankings across top-performing models (All 13 Input Features).FeatureRandom forest (%)Gradient boosting (%)CategoryRankSoil type41.4440.31Agricultural1Water type21.4942.15Agricultural2Brix value11.369.58Chemical3Water content8.237.94Chemical4Reducing sugar %5.130.00Chemical5Pol content3.610.00Chemical6Cane juice weight2.180.00Chemical7Non-sugar content1.990.01Chemical8Season1.590.01Temporal9Location1.310.01Location10Cane variety0.790.00Agricultural11Ratoon type0.600.00Agricultural12Unit type0.270.00Operational13Agricultural subtotal64.3282.45––Chemical subtotal32.5117.52––Other subtotal3.180.02––Total100.00100.00–– Feature importance rankings across top-performing models (All 13 Input Features). Soil Type exhibited the highest predictive importance (41.44%), followed by Water Type (21.49%). Together, these variables accounted for 62.93% of the total predictive importance, exceeding that of chemical composition parameters. While soil type and water type exhibited the highest predictive importance, these findings should be interpreted strictly as predictive associations within the observed dataset rather than as evidence of underlying biological dominance. These variables may act as proxies for broader regional or environmental structures specific to the Erode ecosystem, including unmeasured factors such as microclimate conditions, cultivation practices, or soil–water interactions. Therefore, their prominence in the model should not be interpreted as indicating mechanistic control over jaggery color formation, but rather as reflecting their utility in capturing patterns within the available data. These findings should not be interpreted as overturning established biochemical understanding, but rather as highlighting predictive patterns observable within the current dataset. Figure 6 illustrates the comparative feature importance between the Random Forest and Gradient Boosting algorithms, highlighting the consistent dominance of agricultural parameters across both methods.Fig. 6Feature importance comparison—Random forest versus Gradient boosting. Soil type and water type demonstrate consistent dominance across both algorithms, collectively accounting for 62.93% of predictive power. Feature importance comparison—Random forest versus Gradient boosting. Soil type and water type demonstrate consistent dominance across both algorithms, collectively accounting for 62.93% of predictive power. SHAP explainability analysis To quantify individual feature contributions and address interpretability concerns, we conducted SHAP (SHapley Additive exPlanations) analysis using TreeExplainer on the Random Forest model. SHAP values provide unified feature importance measures by quantifying each feature’s marginal contribution across all possible feature combinations. To further enhance interpretability, partial dependence–style plots were generated using SHAP dependence analysis for the most influential categorical variables, soil type and water source, focusing on the Golden jaggery class representing the premium quality grade (Fig. 7). These plots illustrate the marginal contribution of each category to the prediction outcome while accounting for interactions with other features.Fig. 7SHAP dependence (partial dependence–style) plots illustrating the marginal influence of soil type (a) and water type (b) on Golden jaggery prediction using the independent test set. Positive SHAP values indicate increased likelihood of Golden jaggery, while negative values indicate suppression. SHAP dependence (partial dependence–style) plots illustrating the marginal influence of soil type (a) and water type (b) on Golden jaggery prediction using the independent test set. Positive SHAP values indicate increased likelihood of Golden jaggery, while negative values indicate suppression. Global feature importance Figure 10 presents global rankings based on mean absolute SHAP values. Soil Type (mean \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$|\text {SHAP}|$$\end{document} = 0.1769) and Water Type (mean \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$|\text {SHAP}|$$\end{document} = 0.1129) dominate predictive power, collectively accounting for 29.0% of absolute model impact. This independently validates Random Forest feature importance findings (Table 10), demonstrating consistency across different interpretability methodologies. Class-specific SHAP patterns Table 11 reveals distinct feature contribution patterns for each color category. For Golden jaggery, Water Type shows the strongest influence (SHAP = 0.1694), suggesting water source characteristics are strongly associated with premium Golden coloration in this observational dataset. Conversely, Soil Type dominates Dark brown (SHAP = 0.2193) and Light brown (SHAP = 0.2128) predictions, indicating soil mineral composition primarily determines these outcomes. Feature impact visualization Figure 11 presents the SHAP summary plot for Golden jaggery classification. Higher Water Type values (red points) consistently push predictions toward Golden classification (positive SHAP values), while lower values reduce Golden probability. Similarly, high Brix values and specific soil types show strong positive associations with Golden color formation, directly addressing RQ2 by quantitatively demonstrating how agricultural and chemical parameters influence predictions. Scientific interpretability The SHAP analysis provides three critical validation insights: Agricultural parameters (Soil + Water Type: 29.0% combined SHAP importance) show strong contributions relative to individual chemical parameters, consistent with predictive associations within this dataset rather than evidence of mechanistic dominance.Feature influence patterns vary substantially across color classes, enabling targeted quality management strategies.The model learns predictive associations that are consistent with known biochemical pathways, though these associations do not themselves confirm causal mechanisms7,8, rather than spurious correlations.Table 11SHAP feature importance rankings for the random forest classifier.RankFeatureGlobalDark brownGoldenLight brown1Soil type0.17690.21930.09870.21282Water type0.11290.07820.16940.09123Brix value0.06490.02820.09710.06954Water content (%)0.05280.01720.07800.06325Reducing sugar (%)0.02370.00790.03420.02896Season0.01540.01000.02250.01387Pol0.01200.00770.01510.01338Non-sugar content (%)0.00610.00660.00470.00709Cane juice weight (kg/ton)0.00550.00610.00580.004810Location0.00450.00510.00270.005811Cane variety0.00230.00270.00210.002212Ratoon type0.00210.00240.00130.002713Unit type0.00180.00180.00170.0018Global importance represents average impact across all classes. Values indicate mean absolute SHAP contribution. Higher values = stronger influence on predictions. Top 3 features are highlighted in bold. Agricultural parameters (Soil + Water Type: 29.0% combined SHAP importance) show strong contributions relative to individual chemical parameters, consistent with predictive associations within this dataset rather than evidence of mechanistic dominance. Agricultural parameters (Soil + Water Type: 29.0% combined SHAP importance) show strong contributions relative to individual chemical parameters, consistent with predictive associations within this dataset rather than evidence of mechanistic dominance. Feature influence patterns vary substantially across color classes, enabling targeted quality management strategies. Feature influence patterns vary substantially across color classes, enabling targeted quality management strategies. The model learns predictive associations that are consistent with known biochemical pathways, though these associations do not themselves confirm causal mechanisms7,8, rather than spurious correlations. The model learns predictive associations that are consistent with known biochemical pathways, though these associations do not themselves confirm causal mechanisms7,8, rather than spurious correlations. Table 11SHAP feature importance rankings for the random forest classifier.RankFeatureGlobalDark brownGoldenLight brown1Soil type0.17690.21930.09870.21282Water type0.11290.07820.16940.09123Brix value0.06490.02820.09710.06954Water content (%)0.05280.01720.07800.06325Reducing sugar (%)0.02370.00790.03420.02896Season0.01540.01000.02250.01387Pol0.01200.00770.01510.01338Non-sugar content (%)0.00610.00660.00470.00709Cane juice weight (kg/ton)0.00550.00610.00580.004810Location0.00450.00510.00270.005811Cane variety0.00230.00270.00210.002212Ratoon type0.00210.00240.00130.002713Unit type0.00180.00180.00170.0018Global importance represents average impact across all classes. Values indicate mean absolute SHAP contribution. Higher values = stronger influence on predictions. Top 3 features are highlighted in bold. SHAP feature importance rankings for the random forest classifier. Global importance represents average impact across all classes. Values indicate mean absolute SHAP contribution. Higher values = stronger influence on predictions. Top 3 features are highlighted in bold. Computational efficiency analysis The computational efficiency analysis revealed distinct runtime and memory profiles across the evaluated models, indicating their suitability for different deployment scenarios (Table 12). Random Forest achieved the most favorable performance, with a training time of 0.109 s, prediction time of 0.017 s, and memory usage of 0.07 MB. These results demonstrate that the model can operate efficiently under real-time constraints, making it suitable for deployment in resource-limited environments such as mobile or edge devices. Gradient Boosting and Extra Trees also exhibited competitive performance, though with slightly higher computational costs. In contrast, the Neural Network required increased training time due to iterative optimization, while Support Vector Machine (SVM) demonstrated lower efficiency and scalability limitations for multi-class classification. Overall, tree-based ensemble models provided the best balance between predictive performance and computational efficiency, supporting their practical applicability in industrial settings (Table 13).Table 12Computational efficiency analysis.AlgorithmTraining (s)Prediction (s)Memory (MB)Random forest0.1090.0170.07Gradient boosting0.5350.0030.00Extra trees0.1300.0270.20Neural network1.6680.0010.00SVM0.4260.0640.00Table 13Performance comparison: this study versus previous approaches for agricultural product quality assessment.ApproachAssessment timingEquipment costAccuracyPrimary limitationsComputer vision11,12Post-harvestHigh ($50K+)89–91%Requires expensive imaging hardware; post-production onlyDeep learning13Post-harvestHigh (GPU required)96.2%Large dataset requirements; computational infrastructureHyperspectral imaging14Post-harvestVery high94.8%Laboratory equipment; complex calibrationChemical intervention7,17During processingMediumN/AReactive approach; alters natural product characteristicsThis studyPre-manufacturingLow (mobile device)98.3%Single-region validation; requires multi-regional testing Table 12Computational efficiency analysis.AlgorithmTraining (s)Prediction (s)Memory (MB)Random forest0.1090.0170.07Gradient boosting0.5350.0030.00Extra trees0.1300.0270.20Neural network1.6680.0010.00SVM0.4260.0640.00 Computational efficiency analysis. Table 13Performance comparison: this study versus previous approaches for agricultural product quality assessment.ApproachAssessment timingEquipment costAccuracyPrimary limitationsComputer vision11,12Post-harvestHigh ($50K+)89–91%Requires expensive imaging hardware; post-production onlyDeep learning13Post-harvestHigh (GPU required)96.2%Large dataset requirements; computational infrastructureHyperspectral imaging14Post-harvestVery high94.8%Laboratory equipment; complex calibrationChemical intervention7,17During processingMediumN/AReactive approach; alters natural product characteristicsThis studyPre-manufacturingLow (mobile device)98.3%Single-region validation; requires multi-regional testing Performance comparison: this study versus previous approaches for agricultural product quality assessment. Baseline model comparison A comprehensive baseline evaluation was conducted to establish the complexity requirements for the jaggery color classification (Table 14 and Fig. 8). Notably, a decision tree achieved 96.84% accuracy, closely approaching the ensemble method performance, indicating that jaggery color formation exhibits clear decision boundaries rather than requiring complex algorithmic approaches. Figure 9 presents the learning curves for the Random Forest and SVM algorithms, illustrating the convergence behavior and generalization characteristics of both the high-performing and poor-performing models.Table 14Performance comparison with baseline methods.MethodAccuracy (%)95% CITimingLimitationsMachine learning baselines Decision tree96.8 ± 2.1[94.7, 98.9]Pre-processingLimited complexity Logistic regression61.7 ± 3.2[58.5, 64.9]Pre-processingLinear assumptions Naive bayes81.9 ± 2.8[79.1, 84.7]Pre-processingIndependence assumptionProposed methods Random forest98.3 ± 1.2[97.1, 99.5]Pre-processingRegion-specific Gradient boosting98.3 ± 1.2[97.1, 99.5]Pre-processingRegion-specificFig. 8Baseline comparison chart.Fig. 9Learning curves for classification algorithms. (a) Random forest: Convergence behavior showing minimal gap between training and validation scores, indicating robust generalization without overfitting (Gap: 0.003). (b) Support vector machine: Poor performance with persistent gap between training and validation, explaining poor classification results (71.21% accuracy). Table 14Performance comparison with baseline methods.MethodAccuracy (%)95% CITimingLimitationsMachine learning baselines Decision tree96.8 ± 2.1[94.7, 98.9]Pre-processingLimited complexity Logistic regression61.7 ± 3.2[58.5, 64.9]Pre-processingLinear assumptions Naive bayes81.9 ± 2.8[79.1, 84.7]Pre-processingIndependence assumptionProposed methods Random forest98.3 ± 1.2[97.1, 99.5]Pre-processingRegion-specific Gradient boosting98.3 ± 1.2[97.1, 99.5]Pre-processingRegion-specific Performance comparison with baseline methods. Baseline comparison chart. Learning curves for classification algorithms. (a) Random forest: Convergence behavior showing minimal gap between training and validation scores, indicating robust generalization without overfitting (Gap: 0.003). (b) Support vector machine: Poor performance with persistent gap between training and validation, explaining poor classification results (71.21% accuracy). Spatial generalizability validation To directly assess spatial generalizability for the color classification task, Leave-One-Location-Out Cross-Validation (LOLO-CV) was performed using the Random Forest model across all 19 locations in the dataset. For each iteration, the model was trained on samples from 18 locations and tested on the held-out location. LOLO-CV achieved mean accuracy of 98.32% (SD = 2.00%), with per-location accuracies ranging from 91.30% (Senthampalayam, n = 23) to 100.00% (Athani, Erode). The two locations with accuracy below 97% (Senthampalayam and Salangapalayam) correspond to the smallest sample sizes in the dataset (n = 23 and n = 59, respectively), suggesting that reduced accuracy reflects limited local representation rather than systematic geographic bias. All locations with n\ge100 achieved accuracy \ge97.58%. These results demonstrate robust spatial generalizability within the Erode district, complementing the LOLO-CV validation previously reported for sugar yield regression17. It is important to note that LOLO-CV within a single regional ecosystem does not constitute external validation. These results confirm within-region spatial robustness only. Feature importance stability analysis To assess the robustness of feature importance rankings across different data partitions, the Random Forest model was trained across 10 independent random seeds with different train-test splits. Soil type consistently ranked first (mean importance = 38.98%, SD = 1.41%, coefficient of variation = 3.6%) and Water Type ranked second (mean = 21.93%, SD = 2.07%, CV = 9.4%) across all 10 iterations. The slight variation between the primary model’s Soil Type importance (41.44% in Table 10, random_state = 42) and the multi-seed mean (38.98%) reflects natural variability across data partitions. No permutation of the top-two ranking was observed in any seed, confirming that the identified feature importance hierarchy is robust to data partitioning variability. Test accuracy remained stable at 98.39% ± 0.53% (range: 97.17%–99.17%) across seeds. Location feature ablation analysis To address potential data leakage concerns arising from including Location as an input feature with random train-test splitting, systematic ablation experiments were conducted. Removing the Location feature (12 remaining features) produced identical test accuracy (98.34%), as did removing both Location and Unit Type (11 features, 98.34%) and additionally removing Season (10 features, 98.34%). To formally assess whether these differences are statistically significant, Wilcoxon signed-rank tests were conducted on 10-fold cross-validation accuracy scores between the full 13-feature model and each reduced-feature variant (Wilcoxon tests were selected over paired t-tests as Shapiro-Wilk tests indicated non-normal distributions of paired differences). No statistically significant difference was observed between the full model and the 12-feature model (W = 4.00, p = 1.000), the 11-feature model (W = 0.00, p = 0.500), or the 10-feature model (W = 0.00, p = 0.062), indicating that removal of Location, Unit Type, and Season features does not significantly affect predictive performance (Bonferroni-corrected α = 0.0167). These results provide statistical evidence that model performance is primarily associated with soil type, water type, and chemical composition features rather than location-specific information. The Location feature contributed only 1.31% importance in Random Forest analysis, consistent with its negligible predictive role. Robustness across environmental conditions To assess model robustness beyond algorithmic comparisons, leave-one-group-out analyses were conducted across seasons and sugarcane varieties. Leave-one-variety-out The Random Forest model was trained excluding each sugarcane variety and tested on the held-out variety. All four varieties achieved accuracy exceeding 98%: Co 11015 (98.98%), Co 86032 (98.79%), Pi 1110 (98.67%), and Co 86027 (98.38%), confirming robust generalizability across cultivars within the studied region. Leave-one-season-out Rain Season achieved 100.00%, Summer Season 96.85%, and Winter Season 91.03%. The lower winter accuracy suggests that seasonal variation in environmental conditions may affect the soil–water–color relationships differently during cooler months, potentially due to altered biochemical reaction kinetics during juice concentration at lower ambient temperatures. Summary of key findings In summary, Random Forest achieved optimal classification performance (98.3% accuracy, 98.39% precision) with superior computational efficiency (0.017s prediction time, 0.07 MB memory). Soil type (41.44%) and water type (21.49%) dominated predictive importance (62.93% combined), emerging as primary determinants. Statistical validation confirmed significant performance differences between Random Forest and simpler models (Friedman test: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\chi ^2$$\end{document} = 31.68, p < 0.001), while learning curve analysis validated robust generalization without overfitting (training-validation gap: 0.003). Discussion Fig. 10Global SHAP feature importance for the Random Forest classifier based on mean absolute SHAP values. Soil type and water type exhibit the highest overall contribution to jaggery color classification, followed by Brix value and water content. Global SHAP feature importance for the Random Forest classifier based on mean absolute SHAP values. Soil type and water type exhibit the highest overall contribution to jaggery color classification, followed by Brix value and water content. Agricultural terroir effects in jaggery production The dominance of soil type and water type in predictive models revealed previously unreported predictive associations between agricultural parameters and jaggery color formation, paralleling established research in wine production10,11 where soil composition and water source characteristics significantly influence final product quality through complex biochemical pathways7. Soil type and water type collectively account for 62.93% of predictive importance, raising questions about conventional assumptions regarding chemical composition primacy in jaggery color determination. These results reflect predictive associations within this observational dataset and should not be interpreted as establishing causal primacy of terroir factors over chemical composition. The secondary importance of chemical parameters (Brix value, water content) suggests that these measurements may reflect underlying agricultural influences rather than serve as independent predictive factors. This hierarchical relationship indicates that environmental conditions established during cultivation may influence chemical composition, which subsequently affects color outcomes through biochemical processes during juice concentration. As this study is observational, the demonstrated predictive relationships between agricultural parameters and jaggery color suggest but do not confirm causal dominance of terroir factors. The observed associations may partially reflect unmeasured confounders such as regional microclimate variations or farming practice differences correlated with soil-water combinations. Controlled greenhouse experiments varying soil composition while maintaining genetic uniformity are required to establish causal mechanisms. Decision boundary structure and data characteristics The exceptional performance of a decision tree (96.84%) provides crucial insights into jaggery color formation mechanisms. This minimal 1.5 percentage point gap from ensemble methods (98.3%) indicates that color outcomes follow deterministic patterns with clear decision boundaries rather than complex interactions requiring sophisticated approaches. This finding enables flexible industrial deployment, as manufacturers can select appropriate complexity levels based on operational requirements. The poor performance of Support Vector Machine (71.21% accuracy) provides additional insights into the underlying data structure, despite systematic hyperparameter optimization testing both RBF and polynomial kernels with extensive parameter grids (\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$C \in \{0.1, 1, 10\}$$\end{document}, gamma \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\in \{'scale', 'auto'\}$$\end{document}). The SVM’s fundamental approach–seeking optimal hyperplanes to maximize margin separation in high-dimensional feature space–proved unsuitable for this classification task. This performance gap indicates that jaggery color categories form distinct, non-overlapping clusters with categorical boundaries rather than continuous gradients requiring margin-based separation. The observed region-specific soil-water patterns in this dataset create discrete color groupings that align naturally with tree-based decision boundaries (achieving 96.84–98.3% accuracy) but resist linear and kernel-based hyperplane separation strategies employed by SVMs. The strong performance of shallow models also explains the absence of deeper architectures such as convolutional neural networks or transformer-based models from the evaluated algorithm set. The dataset size (n = 2001) falls substantially below the threshold typically required for effective deep learning training (typically > 10,000 samples for tabular classification), creating significant overfitting risk with high-parameter architectures. More fundamentally, the marginal accuracy gain from a single decision tree (96.84%) to the best ensemble method (98.34%) was only 1.50 percentage points, indicating that the classification task exhibits clear categorical boundaries that do not benefit from the hierarchical feature abstraction capabilities that justify deep learning in complex domains such as image recognition or natural language processing. The Multi-Layer Perceptron evaluated in this study (single hidden layer, 32 neurons) already captures non-linear patterns while maintaining appropriate model complexity for the available data, and its competitive performance (97.84%) relative to ensemble methods further confirms that additional architectural complexity yields diminishing returns for this classification task (Figs. 10, 11).Fig. 11SHAP summary (beeswarm) plot illustrating feature impact on the prediction of Golden jaggery using the Random Forest model. Each point represents an individual sample, colored by feature value. Positive SHAP values indicate increased likelihood of Golden classification. SHAP summary (beeswarm) plot illustrating feature impact on the prediction of Golden jaggery using the Random Forest model. Each point represents an individual sample, colored by feature value. Positive SHAP values indicate increased likelihood of Golden classification. Statistical evidence for deterministic patterns Multiple lines of evidence support the deterministic nature of jaggery color formation: Prediction confidence Across the 601-sample test set, the mean predicted probability for assigned classes was 85.3% ± 10.5%, indicating moderate-to-high model certainty. The confidence distribution reflects the inherent challenge of categorical color prediction from continuous variables, where class boundaries represent discrete categorizations of a continuous quality spectrum. Minimal ensemble improvement The modest gain (+1.46 percentage points from decision tree to Random Forest) contrasts sharply with truly complex classification tasks. In domains requiring capture of subtle non-linear interactions–such as medical diagnosis from high-dimensional biomarker profiles–ensemble methods typically provide 5–15 percentage point improvements over simple baselines. The absence of substantial ensemble benefit indicates that jaggery color formation follows predominantly additive patterns well-captured by shallow decision rules. Cross-model consistency Random Forest (98.34%), Gradient Boosting (98.34%), and Extra Trees (98.17%) converged to nearly identical performance despite fundamentally different optimization strategies. This convergence suggests all algorithms discovered the same underlying decision boundaries inherent to the data structure. Statistical validation and robustness The incorporation of Cohen’s Kappa (κ) as a chance-corrected agreement metric addresses the potential concern of inflated accuracy in imbalanced datasets. With κ values ranging from 0.9671 to 0.9747 for ensemble methods, the results demonstrate that high classification performance is not an artifact of class distribution bias (\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$p_e$$\end{document} = 0.3443) but rather reflects genuine discriminative capability across all three jaggery color categories. The substantial difference between ensemble methods (κ > 0.96) and SVM (κ = 0.5385) further validates the superior pattern recognition capability of Random Forest and Gradient Boosting models, confirming that their high accuracy metrics represent true classification skill rather than overfitting or chance agreement. Comparison with previous agricultural quality assessment approaches Table 13 presents a comprehensive comparison between our pre-manufacturing prediction framework and previous agricultural product quality assessment methodologies. Our approach achieves 98.3% accuracy while requiring only low-cost mobile devices, substantially exceeding computer vision approaches (89–91%)15,16 and hyperspectral imaging methods (94.8%)19 that require expensive post-harvest equipment. More importantly, unlike chemical intervention studies9,22 that require process initiation and alter natural product characteristics, our framework enables proactive quality forecasting using only pre-cultivation parameters. This fundamental timing advantage–predicting outcomes before manufacturing begins–represents a paradigm shift from reactive quality correction to proactive procurement optimization. Model validation against overfitting Multiple lines of evidence demonstrate that the reported high accuracy reflects genuine pattern recognition rather than overfitting: (1) Bootstrap validation confirmed robust performance (mean accuracy 98.32%, 95% CI [97.17%, 99.17%]) across 1000 resampled datasets; (2) Minimal train-test divergence (cross-validation: 98.6%, held-out test: 98.3%, gap: 0.3%) substantially below overfitting thresholds; (3) Learning curves showed convergence with minimal gap (0.003) between training and validation performance, indicating stable generalization rather than memorization (Fig. 9). The confidence interval (width approximately 2.0%) around the test accuracy indicates reliable performance within the validated Erode region; however, users should anticipate potential performance variability under real-world operational conditions, where data quality, measurement consistency, and environmental heterogeneity may differ from the controlled settings of this study. Explainable AI insights and feature interpretability The SHAP explainability analysis strengthens confidence in model validity by demonstrating that predictions rely on scientifically meaningful features rather than data artifacts. The strong predictive contributions of agricultural parameters (Soil Type: 17.69%, Water Type: 11.29%) in SHAP rankings provide independent confirmation of findings from traditional feature importance metrics, consistent with the region-specific associations identified in this observational dataset. Moreover, the class-specific SHAP patterns align with established knowledge of jaggery color formation mechanisms: water mineral content affects enzymatic browning reactions (predominantly influencing Golden classification), while soil-derived nutrients influence Maillard reaction precursor availability (primarily affecting Dark brown and Light brown outcomes)7,8. Practical implementation challenges Despite demonstrated computational feasibility (0.017s prediction time, 0.07 MB memory), real-world deployment faces several practical barriers that must be addressed for successful industrial adoption. Data collection infrastructure Systematic recording of soil type and water source characteristics during sugarcane procurement requires training programs for field officers or development of mobile data collection applications with standardized data entry protocols. The challenge lies in ensuring consistent data quality across hundreds of procurement points, particularly in rural settings with limited connectivity. Standardized assessment protocols While experienced agricultural officers can visually classify major soil types, borderline cases and mixed soil regions require objective assessment criteria. Implementation may benefit from portable soil testing kits or low-cost spectroscopic equipment for water quality assessment. Establishing and enforcing these standards across a distributed procurement network presents significant organizational challenges. Regional model transferability Our validation framework recommends minimum 500-sample datasets per deployment region to verify model accuracy and recalibrate feature importance hierarchies for local environmental conditions. This requirement represents substantial upfront investment in data collection, labeling, and validation testing. Integration with existing systems Many jaggery manufacturers utilize manual record-keeping or basic spreadsheet systems. Deploying ML-based prediction requires either developing standalone mobile applications with offline capability or integrating prediction APIs into existing enterprise resource planning systems. The fragmented nature of the industry demands flexible deployment architectures accommodating diverse technical capabilities. User acceptance Traditional manufacturers often rely on generations of experiential knowledge for quality assessment. Convincing stakeholders to adopt ML-based predictions requires demonstration projects showing clear economic benefits, transparent validation showing prediction reliability, and trust-building through phased implementation where predictions supplement rather than replace human expertise initially. Successful implementation therefore requires coordinated efforts spanning technical deployment, organizational change, economic alignment, and gradual trust-building through pilot projects demonstrating consistent value delivery. Operational deployment framework Phase 1—Data collection (Procurement stage): Field officers record: (1) Supplier farm location, (2) Soil type (visual classification: red/alluvial/black), (3) Water source (canal/river/groundwater/borewell), (4) Cane variety, (5) Ratoon stage, (6) Harvest season via mobile application with offline capability. Phase 2—Laboratory measurement: Upon cane arrival, laboratory technicians measure juice parameters using standard refractometers (Brix), polarimeters (Pol), and chemical assays (reducing sugars, water content). Data entry takes approximately 10 minutes per batch. Phase 3—Prediction generation: Mobile app transmits data to prediction server (or computes locally using embedded model). Random Forest model generates color classification (Golden/Light brown/Dark brown) with confidence score within <1 second. Phase 4—Procurement decision: Manufacturer reviews prediction report showing: expected color category (98% accuracy), confidence level, batch suitability for current production targets. High-confidence Golden predictions routed to premium production lines; other predictions inform chemical intervention decisions or alternative product routing. Phase 5—Validation Feedback Loop: Actual color outcomes recorded post-production. Prediction accuracy monitored continuously; systematic deviations trigger model recalibration using regional data accumulation protocols. It is important to note that the 98.3% accuracy reported here was achieved under standardized data collection conditions. Deployment in commercial settings with variable data entry quality, inconsistent soil classification, or measurement instrument variability may result in reduced real-world performance, and ongoing accuracy monitoring is therefore strongly recommended. Economic impact and industrial applications The proposed predictive framework addresses fundamental value chain inefficiencies by transforming reactive quality management into proactive procurement optimization. Current industrial practices for Golden jaggery production rely on chemical additives to achieve desired color characteristics, increasing production costs and compromising natural product quality. By enabling variety-aware procurement of sugarcane with high Golden-color probability, the framework facilitates chemical-free Golden jaggery production, thereby improving product quality, shelf stability, and market acceptance. Current operational costs Field visits to medium-scale jaggery manufacturing units revealed that chemical additives are used exclusively for Golden jaggery production, while Light brown and Dark brown variants require no chemical intervention. Sodium hydrosulfite is the primary additive employed, with an average market price of approximately INR 400 per kg and a typical usage rate of 1 kg per 2 metric tons of crushed cane. For manufacturing units with an average production capacity of 5–7 metric tons per day and approximately 300 operating days per year, the annual chemical expenditure for Golden jaggery batches ranges from INR 0.30 to 0.42 million. Due to unpredictable color correction outcomes, Golden jaggery production exhibits a quality rejection rate of approximately 10–12%, resulting in rejected batch losses of about INR 0.15–0.20 million annually. Predicted cost savings with the proposed framework By prioritizing naturally Golden sugarcane varieties, the proposed framework reduces dependence on chemical color correction. Field-aligned estimates indicate an 80–90% reduction in hydrosulfite usage, corresponding to annual savings of approximately INR 0.24–0.38 million. In addition, improved raw material selection reduces quality rejection rates by 8–10 percentage points, yielding further savings of INR 0.15–0.20 million per year. The total annual cost savings achieved through the proposed framework are therefore estimated to be in the range of INR 0.39–0.58 million per unit. Revenue enhancement through premium pricing Golden jaggery commands a price premium of approximately 40–60% over light and Dark brown variants, with market prices ranging from INR 80–100 per kg compared to INR 50–60 per kg for non-Golden jaggery. With 25–30% of production optimized for naturally Golden jaggery, manufacturers can achieve additional annual revenue of approximately INR 0.40–0.60 million. Combined economic benefit Considering both cost savings and additional revenue, the combined economic benefit of the proposed framework for a medium-scale jaggery production unit is estimated to be INR 0.79–1.18 million per year, corresponding to approximately USD 9,500–14,000. These estimates are based on field observations conducted during the 2023–2024 production seasons in the Erode region of Tamil Nadu, India. Quality and process implications Field observations further indicate that excessive hydrosulfite addition can result in whitish surface residues or shadow formation on jaggery blocks and powder, which are perceived as quality defects, reducing consumer acceptance and often necessitating reprocessing within the jaggery production cycle. By enabling chemical-free Golden jaggery production through variety-aware procurement, the proposed framework minimizes such defects while improving product consistency, shelf stability, and overall product quality. Generalization evidence and task independence Our previous work demonstrated robust spatial generalization for sugar yield prediction across 18 geographic locations (LOLO-CV mean R\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$^2$$\end{document} = 94.80%, SD = 0.0221)17, establishing that models trained on this dataset capture fundamental agricultural relationships rather than location-specific artifacts. The current color classification task represents an independent validation objective with distinct features (13 vs. 2 parameters), different target variables (categorical vs. continuous), and orthogonal prediction goals (pre-manufacturing quality vs. post-harvest yield). The consistent high performance across both tasks–96.23% R\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$^2$$\end{document} for regression and 98.34% accuracy for classification–provides complementary evidence that measured parameters effectively capture multiple dimensions of jaggery quality. Cohen’s Kappa analysis (κ = 0.9747) further confirms that classification performance reflects genuine pattern recognition rather than chance agreement,particularly critical given the three-class imbalanced dataset structure. Future work should extend validation to other major jaggery-producing regions (Maharashtra, Karnataka) and additional sugarcane varieties to confirm broader geographic applicability beyond the Erode district. Limitations of this study This study has four primary limitations that constrain generalizability and require acknowledgment: Geographic limitation and lack of external validation Model validation is restricted to the Erode region of Tamil Nadu, India. Although a statistically independent held-out test set (30%, n = 601) was used, both training and testing samples originate from the same geographic area. Consequently, the learned relationships between soil type, water source, and jaggery color primarily reflect local environmental and agro-climatic conditions. Jaggery-producing regions such as Maharashtra, Karnataka, and Uttar Pradesh exhibit distinct soil compositions, water quality profiles, and cultivation practices that may alter feature importance and model performance. External validation across multiple geographically distinct regions therefore, remains a critical limitation and a priority for future work. The term “spatial generalizability” in this study refers strictly to within-region generalization within the Erode ecosystem and should not be interpreted as cross-regional validation. Validation across diverse agroecological environments remains necessary to establish broader applicability. Variety-environment interactions The four sugarcane varieties studied (Co 86032, Co 11015, Pi 1110, Co 86027) represent regional cultivars prevalent in Tamil Nadu. Genotype-environment interactions may differ in other regions, potentially reducing model accuracy when applied to different variety-climate combinations. Potential confounding factors The observed agricultural parameter dominance (soil type: 41.44%, water type: 21.49%) may partially reflect unmeasured confounders such as regional microclimate variations, farming practice differences, or processing technique variations correlated with soil-water combinations. Multi-regional studies with balanced experimental designs are required to deconvolve these relationships and confirm causal attribution. Controlled versus operational conditions Model performance was evaluated using standardized laboratory measurements for chemical parameters and systematic sampling protocols. Real-world deployment may encounter greater variability in data quality, measurement precision, and sample representativeness under commercial operational conditions. Field validation studies are necessary to confirm performance consistency across diverse production environments. Ground truth validation protocol Jaggery color classification was initially performed by experienced manufacturers and production workers at each manufacturing unit based on their practical knowledge of commercial grading standards, and subsequently verified by the lead researcher during field visits under standardized natural daylight conditions (10 AM–2 PM). While this dual-assessment process involving experienced industry practitioners and the researcher provides stronger ground truth reliability than single-evaluator classification, formal inter-rater agreement statistics (e.g., Cohen’s Kappa for inter-rater reliability) were not computed between the manufacturer assessments and researcher verification. Additionally, portable colorimetric equipment capable of CIE L*a*b* measurement was not available during the field data collection period (2023–2024), and the decentralized nature of sample collection across 19 locations made centralized laboratory colorimetry impractical. The three color categories represent visually distinct commercial grades that experienced traders classify consistently in routine market transactions, which partially mitigates subjectivity concerns. However, boundary cases between adjacent categories (particularly Golden and Light brown) may be subject to evaluator variability. Future studies should incorporate formal inter-rater reliability assessment across multiple independent evaluators and instrumental color measurement using established colorimetric standards (e.g., CIE L*a*b* with portable handheld colorimeters such as the Konica Minolta CR-400) to establish quantitative ground truth benchmarks. Seasonal variation in model performance Leave-One-Season-Out analysis revealed lower accuracy for Winter Season samples (91.03%) compared to Rain Season (100.00%) and Summer Season (96.85%), suggesting that seasonal environmental variation may affect the learned soil–water–color relationships. Deployment in regions with pronounced seasonal variability may benefit from season-specific model calibration. Dataset accessibility and independent verification The dataset used in this study is maintained under restricted access and is not publicly available through an open repository. While access can be requested through the corresponding author, the absence of an openly accessible dataset or representative publicly available subset constitutes a significant limitation, as it restricts the possibility of independent verification and replication of the reported results by other researchers. Future work should explore the feasibility of releasing an anonymized representative subset to support open science principles while respecting the confidentiality agreements with participating production units. Future research directions and validation requirements Multi-regional validation studies Systematic validation across diverse geographic regions is essential before broader industrial deployment. Each implementation region should undergo the following protocol: Pilot testing: Collect minimum 500 samples per region representing local varieties, soil types, and water sourcesPerformance benchmarking: Establish region-specific accuracy thresholds (target > 95%) to maintain commercial viabilityFeature importance verification: Confirm whether soil-water dominance persists or if regional factors emerge as primary predictorsTransfer learning deployment: Implement systematic domain adaptation using Erode model as foundation Pilot testing: Collect minimum 500 samples per region representing local varieties, soil types, and water sources Pilot testing: Collect minimum 500 samples per region representing local varieties, soil types, and water sources Performance benchmarking: Establish region-specific accuracy thresholds (target > 95%) to maintain commercial viability Performance benchmarking: Establish region-specific accuracy thresholds (target > 95%) to maintain commercial viability Feature importance verification: Confirm whether soil-water dominance persists or if regional factors emerge as primary predictors Feature importance verification: Confirm whether soil-water dominance persists or if regional factors emerge as primary predictors Transfer learning deployment: Implement systematic domain adaptation using Erode model as foundation Transfer learning deployment: Implement systematic domain adaptation using Erode model as foundation Transfer learning protocol for regional deployment Stage 1—Base model preservation: Retain the trained Random Forest architecture from Erode data as the foundation model. The learned decision boundaries capturing soil-chemistry-color relationships serve as prior knowledge applicable across regions. Stage 2—Regional fine-tuning: Collect 200–500 labeled samples from the target region representing local variety-soil-water combinations. Implement domain adaptation using one of two approaches: (a) Weighted ensemble: Combine Erode model predictions with a region-specific model trained on local data using learned weights (typically 0.3–0.4 weight on local model, 0.6–0.7 on base model), or (b) Feature space adaptation: Use Erode model feature importances to initialize local model hyperparameters, constraining the search space for regional optimization. Stage 3—Validation and deployment: Validate the adapted model on an independent regional test set (minimum 150 samples, stratified by local color distribution). Deploy only if regional accuracy exceeds 95%; otherwise, collect additional samples (target: 500–800 total) for full retraining using Erode data as regularization through weighted sample importance. This transfer learning approach minimizes regional data requirements (500 samples vs. 2000 for full retraining from scratch) while maintaining prediction reliability. Preliminary simulation studies (using Erode data split by sub-regions: Anthiyur vs. Bhavani districts) suggest transfer learning can achieve 96–97% accuracy with only 30–40% of full training data requirements, representing substantial cost savings for multi-regional deployment. Mechanistic validation studies Future research should investigate the biochemical pathways linking soil minerals to polyphenol oxidase activity8 and Maillard reaction kinetics7. Controlled greenhouse experiments varying soil composition while maintaining genetic uniformity would confirm causal relationships versus correlational patterns identified in this observational study. Specific research questions include: (1) How do soil-derived iron and magnesium concentrations quantitatively affect enzymatic browning rates? (2) Does water calcium content modulate pH-dependent enzyme activity during juice extraction? (3) Are the observed terroir effects mediated through altered precursor concentrations or direct catalytic influences? Temporal stability assessment Long-term monitoring (3–5 years) is required to assess whether soil-water-color relationships remain stable across climate cycles or require periodic model recalibration due to environmental shifts. Climate change may alter precipitation patterns affecting water mineral content, soil nutrient availability, and temperature-dependent biochemical processes. Establishing automated monitoring systems that track prediction accuracy drift and trigger recalibration protocols will be essential for sustained industrial deployment. Integration with IoT infrastructure Future research should explore integration with Internet of Things (IoT) sensors for automated data collection during sugarcane procurement. Portable soil sensors (NPK, pH, moisture), handheld refractometers (Brix measurement), and mobile water quality meters could enable real-time prediction at procurement points, reducing manual data entry requirements and improving prediction accuracy through standardized measurements. Standardized quality grading systems Development of industry-wide standardized grading systems combining the identified key parameters (soil type and water type, contributing 62.93% predictive accuracy) with traditional industry metrics (Brix, Pol content) would enable broader ML adoption while protecting commercial interests through shared benchmark datasets among researchers. Extension to other agricultural products The methodological framework developed here–combining agricultural terroir parameters with chemical composition for pre-manufacturing quality prediction–is potentially applicable to other terroir-influenced agricultural products such as wine grapes, coffee, cocoa, and specialty honey. Future research should explore transferability of this approach to establish generalized principles for agricultural quality prediction. Conclusion This study established a robust machine learning framework for pre-manufacturing jaggery color classification using cultivation parameters measurable before processing, achieving a test accuracy of 98.3%. Three key findings emerged: (1) Soil type and water type collectively account for 62.93% of predictive importance, raising questions about prevailing assumptions that prioritize post-harvest juice chemistry in jaggery quality determination. These findings represent predictive associations identified through machine learning analysis and do not constitute causal proof of terroir dominance over chemical factors; (2) Rigorous validation through bootstrap resampling, learning curve analysis, and non-parametric statistical testing (Friedman test: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\chi ^2 = 31.68,$$\end{document} p < 0.001) confirmed robust generalization without evidence of overfitting; (3) The framework exhibited high computational efficiency (0.017 s per prediction, 0.07 MB memory), supporting field-level deployment on standard mobile devices. Generalizability constraint Model validation remains geographically constrained to the Erode region (Tamil Nadu, India). Broader applicability will require systematic multi-regional validation, with each target region necessitating pilot datasets of at least 500 samples to verify predictive performance and establish region-specific feature importance hierarchies under local environmental conditions. Practical impact Within validated regions, this framework enables a transition from reactive quality control to proactive procurement optimization. Preliminary economic modeling suggests substantial benefits for medium-scale manufacturers through projected reductions in chemical interventions (approximately 80–85%), minimized quality rejection, and enhanced revenue potential from optimized Golden jaggery production. The framework addresses fundamental value chain inefficiencies while preserving natural product characteristics. Scientific contribution This research establishes quantitative relationships between pre-harvest environmental conditions and final product quality, providing a methodological foundation for predictive agricultural quality assessment. The observed dominance of terroir effects redirects research focus from juice chemistry toward environmental sourcing strategies, with potential applicability to other terroir-influenced agricultural products including wine, coffee, cocoa, and specialty honey. Future research priorities (1) Multi-regional validation across diverse soil-water-climate combinations using transfer learning protocols to minimize data requirements; (2) Mechanistic investigations of biochemical pathways linking soil minerals to enzymatic browning and Maillard reaction kinetics; (3) IoT sensor integration for automated, standardized data collection; (4) Extension of this predictive framework to other agricultural products exhibiting terroir effects; (5) Long-term monitoring (3–5 years) to assess temporal stability of soil-water-color relationships across climate cycles. The applicability of the proposed framework beyond the studied region requires validation across diverse agroecological systems.