DOI: 10.3303/CET23101033 Paper Received: 17 December 2022; Revised: 9 April 2023; Accepted: 8 June 2023 Please cite this article as: da Silva D.D.M.B., Francisco I.C., Raniero G.Z., Monteiro C.C.F., Rossoni D.F., Monteiro A.R., 2023, Application of NIR for Rapid Determination of Flour Quality by Machine Learning, Chemical Engineering Transactions, 101, 193-198 DOI:10.3303/CET23101033 CHEMICAL ENGINEERING TRANSACTIONS VOL. 101, 2023 A publication of The Italian Association of Chemical Engineering Online at www.cetjournal.it Guest Editors: Paolo Ciambelli, Luca Di Palma Copyright © 2023, AIDIC Servizi S.r.l. ISBN 979-12-81206-00-7; ISSN 2283-9216 Application of NIR for Rapid Determination of Flour Quality by Machine Learning Denise de M. B. da Silvaa, Icaro C. Franciscob, Ghiovanni Z. Ranieroc, Claudia C. F. Monteirod, Diogo F. Rossonid, Antonio R.G. Monteiroa a Department of Food Engineer, State University of Maringá, Av. Colombo 5790 bloco J45. 87020-900, Maringa-PR, Brazil. b Department of Statistics, State University of Maringá, Av. Colombo 5790 bloco E90. 87020-900, Maringa-PR, Brazil. c Centre of Agriculture Science, Food Science Post Graduation Program. State University of Maringa, Av. Colombo, 5790 bloco 13. 87020-900, Maringa-PR, Brazil. d Department of Desing, State University of Maringá, Av. Colombo 5790. 87020-900, Maringa-PR, Brazil. argmonteiro@uem.br Wheat is the most produced cereal in the world, and its varieties, locations and planting times directly interfere with its technological quality and derivatives. Therefore, the quality control of wheat flour is of fundamental importance to guarantee the necessary adjustments in the processes due to the natural variations of the Wheat. In this context, this work aimed to evaluate the use of Near Infrared Reflectance spectroscopy (NIR) to estimate rapid results for the quality of wheat flours through Regressions Trees, a supervised Machine Learning approach. Sixty-five analyses were performed to obtain the parameters, and 20 repetitions were to confirm the results obtained. For each of the repetitions, different flours were used, which were analysed in the NIR Analyzer Spectrastar XT-R and, in the sequence, the main physical-chemical and rheological characteristics were analysed: Moisture (AACC 54-21 (2000)), ash (AACC 08-01 (1995)). Colour by Minolta CR400 colourimeter, total and dry gluten (Yucebas Machinery, Mod. Y070073, Turkey), farinographic characteristics (AACC 54-21 (1995)), using Farinografo®️-AT and alveography (AACC 54-3- (2000) by Alveograph Chopin. It was possible to build decision trees that related physical-chemical and rheological variables with the variables from the NIR, resulting in decision rules with reasonable accuracy. In this way, it is concluded that the NIR can be used as a rapid test for the quality control of wheat flour. However, it is necessary to confirm the results of the rheological analyses for more accurate results. 1. Introduction Wheat (Triticum aestivum L.) is one of the three most important grain crops and is widely cultivated worldwide due to its value as a staple food and source of protein. Wheat is essential in human nutrition, the main ingredient of many tasty foods (BRÜTSCH et al., 2017). The Whole grain is rich in nutrients such as minerals, protein (8– 16%), fat (1–3%) and fibre (12–15%) (SENYA et al., 2021).Wheat flour is the primary raw material used in various food formulations, providing the base in which the other ingredients are mixed to form the dough (MORAES et al., 2010, HAJNAL et al., 2014, RANZAN et al., 2014, TACER-CABA et al., 2014, COELHO E SALAS-MELLADO, 2015 ).To obtain flour, clean and conditioned Wheat is reduced through a multi-stage process of successive milling with corrugated and smooth rollers, sieving and purification. At each step, a certain amount of flour is produced, removed and subsequently combined in proportions to form the desired flour (POMERANZ, 1988, POSER and HIBBS, 2005). Roller mills are most used to produce wheat flour, which will later be used in the bakery industry. In addition to reducing energy consumption, grinding quality is very important in the food industry. For example, different wheat flour milling conditions resulted in milled powders with other physical properties (PROTONOTARIOU et al., 2014).Wheat flour's quality includes its chemical composition and technological proprieties. Chemical composition is its Moisture, protein, ash and wet gluten contents. Technological proprieties are sedimentation value, falling number and rheological properties of the flour mass wheat. The quality of this product is of public interest, as it is related to the quality of flour products and human health. Therefore, efficient and convenient analytical techniques are needed for wheat flour quality 193 controls (ZHANG et al., 2022).The rheological quality of wheat flour is mainly determined by the quality and quantity of gluten (GEISSLITZ et al., 2018; Monteiro et al., 2021). The excellent nutritional profile and quality parameters favour its wide application in preparing cookies, bread, muffins, pasta and other snacks (DHAUA et al., 2021). Classical methods have always been used to measure the safety and quality of cereal-based foods with relatively low efficiency compared to emerging nondestructive techniques. Classical methods suffer from the disadvantages of destructiveness and are more time-consuming to obtain results. Therefore, they cannot be used for online monitoring, detection and evaluation. Emerging approaches are reliable with accurate, rapid and non-invasive investigations for authenticating the safety and quality attributes of cereal grains and their products during storage and processing. These innovative technologies can overcome the complexity, problems, destructibility and slowness associated with classic analytical tools (HUSSAIN et al., 2019). The evaluation of the rheological behaviour of the dough is essential in quality control and the development of new bakery products. It can influence the processability, extensibility, resistance to stretching, gas retention capacity of the dough, viscoelasticity and, consequently, the physical and sensory properties of baked bread. Quantifying the rheological properties of wheat flour doughs can be helpful in the process of improving and optimising manufacturing techniques (MIRONEASA et al., 2019). The rheological property of wheat flour-based dough influences its processing characteristics, which is crucial for final products (GE et al., 2023). The rheological property of wheat flour is mainly given by the gluten network structure, which was formed by the massive bonds of gluten molecules through disulfide bonds, hydrogen bonds and hydrophobic forces (McCANN and DAY, 2013).To ensure product compliance with the standards established by the quality control criteria of products received for industrialisation, the need to develop new, simple, fast and low-cost analytical methodologies to determine the quality of wheat flour.Near-infrared (NIR) spectroscopy can identify the chemical composition of food products. It could be used to provide detailed identification of changes in physicochemical properties during food processing and integrate them into quality control strategies when related to the industrial processing and control of raw materials received by the industry. It has the advantages of being fast, nondestructive, low-cost, real-time, and reproducible and has the potential for future applications in the intelligent control of food production (DEIDDA et al., 2019). In this scenario, near-infrared (NIR) spectroscopy has already been used to determine the chemical composition (water, protein, ash, damaged starch, oleic acidity, Hagberg drop number and TOTOX), analytical profiles (farinograph, alveograph and solvent retention) (LANCELOT et al., 2021, YE et al., 2018). Foods' physical properties and chemical composition are strongly correlated and can be reflected in characteristic NIR spectra. In addition, machine learning can be used to model such predictive relationships based on NIR spectra (JIANG et al., 2023). Evaluating the final model is critical to obtain a stable and robust model. The correlation coefficient (R), coefficient of determination (R 2 ) and correlation coefficient for prediction (R p ) are often used to evaluate the performance of constructed models. The best models typically have the highest R and R 2 or sometimes R p while having a lower root mean square prediction error (RMSEP) and root mean square cross-validation error (RMSECV) (MINAS et al. al., 2021 ). Furthermore, the residual predicted deviation (RPD) is used to assess model stability, and a higher RPD indicates better predictive performance (KUTSANEDZIE et al., 2018). In this context, the objective of this study was to use machine learning methods to estimate the reliability of NIR spectra compared to traditional methods for wheat flour quality control. 2. Material and methods Wheat milling In this work, wheat flour was obtained from industrial and experimental methods. Two-thirds of the samples were from experimental milling, and one-third were from industrial milling. Analyses of 68 samples were performed to build the models and 17 samples to confirm the results. Milling in experimental mill To produce flour in an experimental mill, the Moisture of the Wheat was first determined, and later, the percentage of water to be added was determined by calculation, considering the initial Moisture (IM), the desired Moisture (DM) and the weight of the flour sample, according to equation 1. Water added (ml) = ( 100−𝐼𝑀 100−𝐷𝑀−1 ) 𝑋 𝑠𝑎𝑚𝑝𝑙𝑒 𝑤𝑒𝑖𝑔ℎ𝑡 eq 1 After adding water, the Wheat rested for 4 four hours, and grinding was performed in an Experimental Mill VG 2000i (Vitti Molinos, Brazil). 194 Milling in industrial mill The industrial milling was carried out continuously, where a wetting screw humidifies the Wheat. The initial Moisture of the Wheat is determined; subsequently, the Wheat is humidified and will rest for 16 hours. After the humidified Wheat had rested, the milling was started. The process was basically in 3 stages: Grinding, reduction, and compression.In the grain-crushing stage, the coarsest product is obtained (a higher percentage of bran). The reduction is where the dressed semolina is worked (endosperm with small amounts of bran). The roller will separate this bran and send it to the finer grindings and the semolina to the compression banks. The cylinder banks will break the semolina and transform it into wheat flour. Sieving is done by plansifters, where each pass has a diagram with screens of different openings to correctly distribute each product to the next pass, according to the desired granulometry. Conventional analytical methods Physicochemical analysis The moisture content of the flour was measured according to method No. 44-15 A of the AACC (2000). The percentage of ash was determined according to method nº 08-01 of the AACC (1995). The colour of the flours was evaluated using a Minolta CR-400 colourimeter. The results were expressed in L* values, whose L* values (brightness or brightness) range from black (0) to white (100), according to Monteiro et al (2016).Gluten washing equipment (Yucebas Machinery, Mod. Y070073, Turkey) was used to determine the quantity and quality of gluten in wheat flours, according to method nº 38-12 of the AACC (1995). The gluten index was determined, corresponding to the percentage of wet gluten remaining on the sieve, part of the equipment, after centrifugation (Yucebas Machinery, Mod. Y080067, Turkey). Then, the dry gluten content was determined, corresponding to the weight (%) of the washed dough after drying between two heated gluten dryer plates (Yucebas Machinery, Mod. Y090042, Turkey). Rheological analyses of flour Method No. 56-81 B of the AACC (2000) was followed to analyse the number of falls. The farinographic characteristics of the wheat flours used in the experiment were evaluated according to method nº 54-21 of the AACC (1995), using the Farinógrafo®-AT (Brabender, Germany). From the farinogram, the following parameters were analysed: water absorption (ABS) and development time (TD).The alveograph analysis was carried out in the Chopin Alveograph equipment, following method no. 54- 30 A, established by the AACC (2000). Fast analysis by NIR For the quick analysis, the NIR Analyzer Spectrastar XT-R (KPM Analytics, USA) (was used with the calibration provided by the manufacturer to Moisture, Protein, Ash, Alveo P, Alveo W, Color B, Water ABS, Dev Time. Figure 1 shows the calibration of protein sourced by the manufacturer (SpectraStar XT-R Calibration Library, 2021). Figure 1. NIR Analyzer XT-R calibration for protein Statistical analyses Regression tree learning is a supervised learning approach used in statistics, data mining and machine learning. The regression trees divide the data into subsets: branches, nodes, and leaves. The regression trees select splits that decrease the dispersion of target attribute values. Thus, the target attribute values can be predicted 195 from their mean values in the leaves. In this context, we use the results obtained by NIR Analyzer Spectrastar XT-R (KPM Analytics, USA) to build our regression tree, aiming to predict and compare the results with those obtained in the lab. To verify the quality of the fit and prediction, the database was divided into 80% for training the Machine Learning algorithm and 20% for prediction. 3. Results and discussion Considering Moisture (AACC 54-21 (2000)) as the response variable, all covariates obtained by the NIR method were used to build the regression tree and subsequent prediction. The tree had 4 nodes, making a total of 5 classifying branches shown in Table 1. Table 1. Classifying branches Rules Cover 1. when ALVEO W NIR < 255 & Abs NIR >= 65 11% 2. when ALVEO W NIR < 255 & Abs NIR < 65 31% 3. when ALVEO W NIR >= 255 & Gluten Um NIR >= 29 & ALVEO L NIR >= 85 26% 4. when ALVEO W NIR >= 255 & Gluten Um NIR >= 29 & ALVEO L NIR < 85 18% 5. when ALVEO W NIR >= 255 & Gluten Um NIR < 29 13% Figure 2. Regression tree for Moisture Table 2: Comparison between Lab Results and ML Prediction by Regression Tree for Moisture Lab Results ML Prediction (Regression Tree) Error 13,7000 14,0113 -0,3112 14,0500 14,0113 0,0388 13,8600 14,0113 -0,1512 14,4400 14,0113 0,4288 13,4400 14,0113 -0,5712 14,4200 14,0113 0,4088 13,9400 14,0113 -0,0712 14,1300 14,0113 0,1188 13,8600 14,0113 -0,1512 13,8600 14,0113 -0,1512 14,0400 14,0113 0,0288 14,1100 14,0113 0,0988 14,0400 14,0113 0,0288 14,3900 14,0113 0,3788 14,5500 13,8821 0,6679 13,8300 14,0113 -0,1812 196 The branches, represented by the classification rules, obtained coverage of 31%, 26%, 18%, 13% and 11%. Considering these rules, we have in Table 2 the prediction of Moisture (AACC 54-21 (2000)) values via regression tree, compared with the real data obtained in the laboratory. Considering the other variables of the study, the prediction of values via regression tree obtained results close to laboratory ones, both for the Physicochemical and Rheological variables. This was verified by the adjustment measures such as the Average Error and the MAE shown in Table 3. Table 3: Mean values obtained in the laboratory, mean predicted by ML, mean error, and mean absolute error (MAE) for the test database considering each experimental variable. Variable Lab (mean) ML Prediction (mean) Error MAE Moisture 14,04 14,00 0,04 0,24 Development Time 6,14 5,16 0,99 2,84 Gluten Index 32,48 31,39 1,09 1,39 Water Absorption 57,37 56,83 0,54 1,11 Alveograph L 105,63 99,78 5,84 17,67 Alveograph P 81,25 80,97 0,28 8,47 Alveograph W 285,88 275,35 10,52 32,65 Colour 92,03 91,67 0,35 0,78 4. Conclusions Regression Trees associated with Fast analysis by NIR obtained accurate estimates, both for the Physicochemical and Rheological variables, when compared with data obtained in the laboratory. It was possible to build regression trees with the identification of classifiers by nodes, branches and leaves to predict wheat flour quality more accuracy than linear regression. Acknowledgements This work is supported by PROAP/Capes and Fundação Araucária / Paraná. References AMERICAN ASSOCIATION OF CEREAL CHEMISTS - AACC. Approved Methods of the American Association of Cereal Chemists. 9 v. 2. ed. Saint Paul: AACC, 1995. AACC. American Association of Cereal Chemists. Approved Methods, 10. ed. St. Paul: AACC, 2000. Brütsch, L., Huggler, I., Kuster, S., Windhab, E. J., 2017, Industrial Roller Milling Process Characterisation for Targeted Bread Quality Optimization, Food Bioprocess Technol, 10,710 - 719. Coelho, M. S., Salas-Mellado, M. M., 2015, Effects of substituting chia (Salvia hispanica L.) flour or seeds for wheat flour on the quality of the bread, LWT - Food Science and Technology, 60, 729-736. Deidda, R., Sacre, P.-Y., Clavaud, M., Coïc, L., Avohou, H., Hubert, P., Ziemons E., 2019 Vibrational spectroscopy in the analysis of pharmaceuticals: Critical review of innovative portable and handheld NIR and Raman spectrophotometers TrAC, Trends Anal. Chem., 114, 251-259. Dhua, S., Kheto, A., Sharanagat, V. S., Singh, L., Kumar, K., Nema, P. K., 2021, Quality characteristics of sand, pan and microwave roasted pigmented Wheat (Triticum aestivum), Food Chemistry, 365. Senya, E. K., Kwaatemaa, F., Sitsofe, K.R., 2021, Production and acceptability of Tit-Bits made from Wheat and Tiger nut flour blends, Int. J. Academic and Applied Research, 5, 142-147. Ge, W., Xu, Y., Niu, M., Jia, C., Zhao, S. 2023, The differentiation between condensed and hydrolysable tannins with different molecular weights in affecting the rheological property of wheat flour-based dough, Journal of Cereal Science, 111, 103666. Geisslitz, S., Wieser, H., Scherf, K. A., Koehlerb, P., 2018, Gluten protein composition and aggregation properties as predictors for bread volume of common Wheat, spelt, durum wheat, emmer and einkorn, Journal of Cereal Science, 83, 204–212. Hajnal, E. J. J., Tomić, J., Torbica, A., Rakita, S., Pojić, M., Živančev, D., Dapčević Hadnađev, T., 2014, Content of free amino groups during postharvest Wheat and flour maturation in relation to gluten quality, Food Chemistry, 164, 158-165. Hussain, N., Sun, D., Pu, H., 2019, Classical and emerging nondestructive Technologies for safety and quality evaluation of cereals: A review of recente applications, Trends in Food Science & Technology, 91, 598-608. 197 Jiang, Q., Zhang, M., Mujumdar, A. S., Wang, D., 2023, Nondestructive quality determination of frozen food using NIR spectroscopy-based machine learning and predictive modelling, Journal of Food Engineering, 343, 111374. Kutsanedzie, F. Y. H., Chen, Q., Hassan, M. M., Yang, Sun, M. H., Rahman, M.H., 2018, Near infrared system coupled chemometric algorithms for enumeration of total fungi count in cocoa beans neat solution, Food Chem., 240, 231-238. Lancelot, E., Fontaine, J., Grua-Priol, J., Le-Bail, A., 2021, Effect of long-term storage conditions on wheat flour and bread baking properties, Food Chemistry, 346, 128902. McCann, T.H., Day, L., 2013, Effect of sodium chloride on gluten network formation, dough microstructure and rheology in relation to breadmaking, J. Cereal. Sci., 57,444-452. Minas, I.S., Blanco-Cipollone, F., Sterle, D., 2021, Accurate nondestructive prediction of peach fruit internal quality and physiological maturity with a single scan using near infrared spectroscopy, Food Chem., 335, Article 127626. Mironeasa, S., Iuga, M., Zaharia, D., Mironeasa, C., 2019, Rheological analysis of wheat flour dough as influenced by grape peels os diferente particle sizes and addition levels, 12, 228-245. Monteiro A.R.G., Nakagawa A., Pimentel T.C., Sousa I. (2021) Increasing saltiness perception and keeping quality properties of low salt bread using inhomogeneous salt distribution achieved with salt agglomerated by waxy starch LWT, 146, art. no. 111451, DOI: 10.1016/j.lwt.2021.111451 Monteiro A., Marques D., Marchi L., Chinellato M., Berwig K., Wolf B., 2016, Eliminating the use of fat in the production of extruded snacks by applying starch coating, Chemical Engineering Transactions, 49, 625-630 DOI: 10.3303/CET1649105 Moraes, K.S., Zavareze, E.R., Miranda, M.Z., Salas-Mellado, M.M., 2010, Technological evaluation of cookies with lipid and sugar content variations, Food Science and Technology, 30, 233-242. Pomeranz, Y. 1988, Wheat: chemistry and technology. St.Paul, MN, USA: AACC International. Poser, E. S., Hibbs, A.N. 2005, Wheat flour milling, chapters, AACC International, St. Paul, MN, USA. 5–9,185- 327. Protonotariou, S.; Drakos, A.; Evageliou, V.; Ritzoulis, I. C., 2014 Mandala Sieving fractionation and jet mill micronisation affect the functional properties of wheat flour. J. Food Eng., 134. Ranzan, C., Strohm, A., Ranzan, L., Trierweiler, L.F., Hitzmann, B., Trierweiler J.O., 2014, Wheat flour characterisation using NIR and spectral filter based on Ant Colony Optimization, Chemometrics and Intelligent Laboratory Systems, 132, 133-140. SpectraStar XT-R Calibration Library, 2021 available on https://assets-global.website- files.com/63cf34956bc59159af577c42/63cf34956bc591f56a5785f4_SpectraStar%20XT- R%20Unity%20Calibrations%20V1.1%20April%202021.pdf Tacer-Caba, Z., Nilufer-Erdil, D., Boyacioglu, M. H., Ng, P.K.W., 2014, Evaluating the effects of amylose and Concord grape extract powder substitution on physicochemical properties of wheat flour extrudates produced at different temperatures, Food Chemistry, 157, 1476-1484. Ye, D., Sun, L., Zou, B., Zhang, Q., Tan, W., Che, W., 2018, Nondestructive prediction of protein content in Wheat using NIRS Spectrochimica Acta Part A: Molecular and Biomolecular Spectroscopy, 189, 463-472. Zhang, S., Liu, S., Shen, L., Chen, S., He, L., Liu, A. 2022, Application of near-infrared spectroscopy for the nondestructive analysis of wheat flour: A review, Current Research in Food Science, 5, 1305 – 1312. 198 304exicheapSilva.pdf Application of NIR for Rapid Determination of Flour Quality by Machine Learning