Beer Aroma and Quality Traits Assessment Using Artificial Intelligence

Increasing beer quality demands from consumers have put pressure on brewers to target specific steps within the beer-making process to modify beer styles and quality traits. However, this demands more robust methodologies to assess the final aroma profiles and physicochemical characteristics of beers. This research shows the construction of artificial intelligence (AI) models based on aroma profiles, chemometrics, and chemical fingerprinting using near-infrared spectroscopy (NIR) obtained from 20 commercial beers used as targets. Results showed that machine learning models obtained using NIR from beers as inputs were accurate and robust in the prediction of six important aromas for beer (Model 1; R = 0.91; b = 0.87) and chemometrics (Model 2; R = 0.93; b = 0.90). Additionally, two more accurate models were obtained from robotics (RoboBEER) to obtain the same aroma profiles (Model 3; R = 0.99; b = 1.00) and chemometrics (Model 4; R = 0.98; b = 1.00). Low-cost robotics and sensors coupled with computer vision and machine learning modeling could help brewers in the decision-making process to target specific consumer preferences and to secure higher consumer demands.


Introduction
Due to the high popularity of beer worldwide-78% of total volume sales among the alcoholic beverages-and consumers demanding premium beers with higher quality (e.g., foam, aromas, flavors, tastes), there is an increased need for more reliable, accurate, cost-effective, and less time-consuming methods to assess quality traits of beers at the end of the production line [1][2][3][4][5]. Traditional methods to analyze physicochemical parameters for beverages involve costly equipment and require specialized personnel. Furthermore, instrumentation must be installed in designated laboratory areas such as the gas chromatographs with mass-spectroscopy (GC-MS) that require a ventilated laboratory space with gas detectors and special gas cylinders to function. These conventional techniques also require the use of consumables and tend to be time-consuming [1,6,7]; therefore, results are not readily available to brewers, which hinders the ability to modify formulations or processes to improve beer quality traits rapidly.
Artificial intelligence (AI), which refers to the automation of machines that have the ability to behave like humans in the sense of thinking, problem-solving, decision-making, and self-learning, is composed of different branches such as computer vision (CV), robotics, sensors, and machine learning (ML) [1,8]. These techniques have been recently applied in the food and beverage industries to develop more efficient methods for the assessment of the products in terms of quality and consumer acceptability. Specifically for beer, CV has been used to assess color from images [9,10], bubble size and haze [11], and foam-related parameters [12][13][14]. The use of robotics has also been reported

Physical Measurements-RoboBEER
All samples (N = 60) were analyzed using an automatic robotic pourer (RoboBEER; The University of Melbourne, Parkville, Vic, Australia). As detailed by Gonzalez Viejo et al. [14], this robot is able to pour the beer bottles automatically while being recorded by a smartphone for 5 min. Furthermore, RoboBEER has three sensors that measure temperature, alcohol gas (OH), and carbon dioxide (CO 2 ) in real-time during the pouring. The recorded videos are then processed using computer vision algorithms developed in Matlab ® R2020a (Mathworks, Inc., Natick, MA, USA) to obtain parameters such as (i) lifetime of foam (LTF), (ii) total lifetime of foam (TLTF), (iii) maximum volume of foam (MaxVol), (iv) foam drainage (FDrain), color in (v, vi, vii) CIELab and (viii, ix, x) RGB scales, and bubble size distribution in the foam as (xi) small (SmBubb), (xii) medium (MedBubb), and (xiii) large (LgBubb).

Aromas-Gas-Chromatography Mass-Spectroscopy
As described by Gonzalez Viejo et al. [7,26], a total of 5 mL of each of the triplicates of the beers were placed in 20 mL vials and analyzed using a gas-chromatograph with a mass-selective detector 5977B (GC-MSD; Agilent Technologies, Inc., Santa Clara, CA, USA), which is integrated with an autosampler system PAL3 (CTC Analytics AG, Zwingen, Switzerland). The method used was based on headspace with solid-phase microextraction (SPME) divinylbenzene-carboxen-polydimethylsiloxane (DVB-CAR-PDMS) grey fiber. The carrier gas was helium, and an HP-5MS column was used. Furthermore, two blanks were included at the start and end to ensure no carryover effects. The National Institute of Standards and Technology library (NIST; National Institute of Standards and Technology, Gaithersburg, MD, USA) was used to identify the volatile aromatic compounds, and only those with >80% certainty were used.

Near-Infrared Spectroscopy
A microPHAZIR™ RX Analyzer (Thermo Fisher Scientific, Waltham, MA, USA) was used to measure the near-infrared absorbance values within the 1596-2396 nm range every 7-9 nm. The samples were impregnated in a Whatman ® filter paper (Whatman plc. Maidstone, UK), qualitative grade three, and 7.0 cm diameter. This was used to measure the beers by placing the white background on top to avoid signal noise caused by environmental interference. The values of a dry filter paper were subtracted from those containing the beer samples to remove the cellulose peaks. All samples were measured at room temperature (20-23 • C).

Other Chemical Measurements
A 50 mL sample of each beer was used to measure the total dissolved solids (TDS) and electrical conductivity (Econd) using a Yuelong YL-TDS2-A digital tester (Zhengzhou Yuelong Electronic Technology Co., Ltd., Zhengzhou City, Henan Province, China). The same samples were used to obtain the pH with a pH-meter (QM-1670, DigiTech, Sandy, UT, USA), and salt concentration using a digital salt-meter (PAL-SALT Mohr, Atago Co., Ltd., Saitama, Japan). Total soluble solids were measured using an optical refractometer Alla France REFBX010 (Alla France Sarl, Chemillé-Melay, France), with a range of measurement 0-32 Brix. On the other hand, a 60 mL sample was obtained to assess the alcohol concentration using an Alcolyzer Wine M alcohol meter (Anton Paar GmbH, Graz, Austria) with <0.1% vv −1 accuracy.

Statistical Analysis and Machine Learning Modeling
An ANOVA was conducted to assess if there were significant differences among the samples using Fishers least significant differences (LSD) as a post hoc test (α = 0.05). The latter was performed using the SAS ® 9.4 software (SAS Institute Inc., Cary, NC, USA). Furthermore, all data were evaluated using a multivariate data analysis based on principal components analysis (PCA) with Matlab ® R2020a (Mathworks, Inc., Natick, MA, USA).
The absorbance values obtained with the NIR device were used as inputs to develop two artificial neural network (ANN) models to predict the peak area of six volatile aromatic compounds (Model 1; Figure 1) and six chemical parameters (Model 2; Figure 1). These were constructed using a code written in Matlab ® R2020a to evaluate 17 different training algorithms to find the most accurate models and with the highest performance. On the other hand, the 15 parameters obtained from the RoboBEER measurements were used as inputs to develop two more models to predict the peak area of six volatile aromatic compounds (Model 3; Figure 1) and six chemical parameters (Model 4; Figure 1). All models were developed using a random data division, with 70% of the samples used for training with the Bayesian regularization algorithm and 30% for testing using a default derivative function and performance based on means squared error. Ten neurons were selected as the best for all four models to obtain the highest accuracy with no overfitting. The absorbance values obtained with the NIR device were used as inputs to develop two artificial neural network (ANN) models to predict the peak area of six volatile aromatic compounds (Model 1; Figure 1) and six chemical parameters (Model 2; Figure 1). These were constructed using a code written in Matlab ® R2020a to evaluate 17 different training algorithms to find the most accurate models and with the highest performance. On the other hand, the 15 parameters obtained from the RoboBEER measurements were used as inputs to develop two more models to predict the peak area of six volatile aromatic compounds (Model 3; Figure 1) and six chemical parameters (Model 4; Figure  1). All models were developed using a random data division, with 70% of the samples used for training with the Bayesian regularization algorithm and 30% for testing using a default derivative function and performance based on means squared error. Ten neurons were selected as the best for all four models to obtain the highest accuracy with no overfitting.

Figure 2a
shows the normalized mean values of the RoboBEER parameters (color, foam, and bubbles) for each sample. There were significant differences (p < 0.05) between samples in all parameters. It can be observed that the spontaneous fermentation samples such as OG and LW were the highest in MaxVol with 61.9 and 57 mL, respectively (Table S1). On the contrary, the bottom fermentation beers XX and C were the lowest in MaxVol, with 7 and 8.3 mL, respectively. The spontaneous fermentation beers LK and LG were the highest in small bubbles in the foam (4809 and 4084, respectively), while the bottom fermentation samples XX and C had the lowest SmBubb (603 and 617, respectively). Figure 2b shows the normalized mean values of the peak areas of the volatile aromatic compounds. There were significant differences among samples in all aromas. It can be observed that o-Tolualdehyde, which provides cherry-like aromas, was only found in three samples (CS, LK, and RT), and these had significant differences among them (Table S2). Samples OG and L had the highest peaks in ethyl caproate, which is associated with aromas such as green apple and green bananas. On the other hand, ethyl decanoate (apple/grapes) and ethyl laurate (waxy/floral) were the most abundant in CS, and least abundant in BC. Figure 2c shows the normalized mean values of the chemical measurements. Similar to the other parameters, there were significant differences among the samples for all variables. It can be noted that the spontaneous fermentation beers LF and LC were the highest in TDS (1226 and 1207 ppm, respectively), Econd (2608 and 2568 µs cm −1 , respectively), and salt (0.10% both samples), with the bottom fermentation sample XX as the lowest in the three parameters (TDS = 469 ppm, Econd = 997 µs cm −1 , and salt = 0.02%; Table S3). The lowest pH value was found for LC (2.85), while BC had the highest (4.69). On the other hand, the sample LF had the highest Brix value (10.83 Brix) and the lowest alcohol content (2.53%).

Figure 2a
shows the normalized mean values of the RoboBEER parameters (color, foam, and bubbles) for each sample. There were significant differences (p < 0.05) between samples in all parameters. It can be observed that the spontaneous fermentation samples such as OG and LW were the highest in MaxVol with 61.9 and 57 mL, respectively (Table S1). On the contrary, the bottom fermentation beers XX and C were the lowest in MaxVol, with 7 and 8.3 mL, respectively. The spontaneous fermentation beers LK and LG were the highest in small bubbles in the foam (4809 and 4084, respectively), while the bottom fermentation samples XX and C had the lowest SmBubb (603 and 617, respectively). Figure 2b shows the normalized mean values of the peak areas of the volatile aromatic compounds. There were significant differences among samples in all aromas. It can be observed that o-Tolualdehyde, which provides cherry-like aromas, was only found in three samples (CS, LK, and RT), and these had significant differences among them (Table S2). Samples OG and L had the highest peaks in ethyl caproate, which is associated with aromas such as green apple and green bananas. On the other hand, ethyl decanoate (apple/grapes) and ethyl laurate (waxy/floral) were the most abundant in CS, and least abundant in BC. Figure 2c shows the normalized mean values of the chemical measurements. Similar to the other parameters, there were significant differences among the samples for all variables. It can be noted that the spontaneous fermentation beers LF and LC were the highest in TDS (1226 and 1207 ppm, respectively), Econd (2608 and 2568 µs cm −1 , respectively), and salt (0.10% both samples), with the bottom fermentation sample XX as the lowest in the three parameters (TDS = 469 ppm, Econd = 997 µs cm −1 , and salt = 0.02%; Table S3). The lowest pH value was found for LC (2.85), while BC had the highest (4.69). On the other hand, the sample LF had the highest Brix value (10.83 Brix) and the lowest alcohol content (2.53%).   Brix was positively related to o-Tolualdehyde and "a". The spontaneous fermentation samples (pink stars) were associated with the foam-related parameters, while the top (blue squares) and bottom (green diamonds) fermentation beers were more associated with pH, RGB color scale, and FDrain. The top-fermenting sample Z was separated from all other beers from the same fermentation and was associated with Brix and "a". and bottom (green diamonds) fermentation beers were more associated with pH, RGB color scale, and FDrain. The top-fermenting sample Z was separated from all other beers from the same fermentation and was associated with Brix and "a".  Table 1. Table 2 shows the statistical results of the four ML models; it can be observed that Model 1 to predict aromas using NIR as inputs had a high overall correlation coefficient (R = 0.91). However, the accuracy of the testing stage was moderate (R = 0.73; Slope = 1.00) and much lower than the training stage (R = 1.00). Model 2 constructed using NIR as inputs to predict the chemical data also had high overall accuracy (R = 0.93), but it has similar results to Model 1 for the testing stage (R = 0.75), which is much lower than the training stage (R = 1.00). This is a sign of possible overfitting of the models.  Table 1. Table 2 shows the statistical results of the four ML models; it can be observed that Model 1 to predict aromas using NIR as inputs had a high overall correlation coefficient (R = 0.91). However, the accuracy of the testing stage was moderate (R = 0.73; Slope = 1.00) and much lower than the training stage (R = 1.00). Model 2 constructed using NIR as inputs to predict the chemical data also had high overall accuracy (R = 0.93), but it has similar results to Model 1 for the testing stage (R = 0.75), which is much lower than the training stage (R = 1.00). This is a sign of possible overfitting of the models. On the other hand, Model 3 developed using the RoboBEER parameters as inputs to predict the aromatic compounds had a very high overall accuracy (R = 0.99), with the R-value of the testing stage (R = 0.96) not far from that of the training (R = 0.99). Furthermore, the slope values of the three stages were 1.00, and the training performance (MSE < 0.01) was lower than the testing (MSE = 0.04), which are signs of no overfitting. Model 4 to predict chemical data using the RoboBEER variables as inputs also had a very high overall accuracy (R = 0.98), with the R-value of the testing stage (R = 0.95) close to the training (R = 0.99). Similar to Model 3, this had slope values of 1.00 for the three stages and high performance, with the training stage (MSE < 0.01) being lower than the testing (MSE = 0.04).  Figure 4 shows the overall regression of the four models. Model 1 and Model 3 had 5% of outliers (18 out of 360) based on the 95% confidence bounds. However, in the graph, it can be observed that phenylethyl alcohol (red ×) had the highest number of outliers in Model 1, while ethyl caproate (blue +) had the highest number outliers in Model 3. On the other hand, Model 2 and Model 4 had 4.7% of outliers (17 out of 360) according to the 95% confidence bounds. In Model 2, pH (black ) presented most of the outliers, while in Model 4, Econd (red *) represented the highest number of outliers. In both Model 1 and Model 2, the outliers seem to have a higher error than those in Model 3 and Model 4.

Discussion
As expected, the spontaneous fermentation beers such as OG, LW, OT, and LK were the highest in MaxVol, TLTF, and CO2, while the top and bottom fermentation samples (CS, XX, and C) were the lowest. This is due to the prolonged fermentation (≥ 2 years) that the spontaneous types have, which allows the production of higher CO2 [27] along with the use of cork, which aids in better sealability. On the contrary, bottom and top fermentation are carried out in five days to a few weeks and use regular thinner bottles with a bottle cap, which leads to the leaking of gas [14,28]. Some of the most abundant aromatic volatile compounds found in the samples used in this study were those related to aromas such as fruity (apple, banana, pineapple, grapes), floral (rose, honey), and waxy. Similar to the findings in the present study, other authors have identified compounds such as ethyl caproate, ethyl octanoate, phenylethyl alcohol, and ethyl decanoate in beer samples from the three types of fermentation [29,30].
Even though TDS, Econd, and salt concentration are not usually measured in beer, these are an indicator of the minerals content, especially from water, as this is the main ingredient in beer, and its hardness (minerals) level is crucial to determine the final product's sensory attributes. For example, hard water with a high concentration of iron used for brewing has been associated with off-flavors

Discussion
As expected, the spontaneous fermentation beers such as OG, LW, OT, and LK were the highest in MaxVol, TLTF, and CO 2 , while the top and bottom fermentation samples (CS, XX, and C) were the lowest. This is due to the prolonged fermentation (≥2 years) that the spontaneous types have, which allows the production of higher CO 2 [27] along with the use of cork, which aids in better sealability. On the contrary, bottom and top fermentation are carried out in five days to a few weeks and use regular thinner bottles with a bottle cap, which leads to the leaking of gas [14,28]. Some of the most abundant aromatic volatile compounds found in the samples used in this study were those related to aromas such as fruity (apple, banana, pineapple, grapes), floral (rose, honey), and waxy. Similar to the findings in the present study, other authors have identified compounds such as ethyl caproate, ethyl octanoate, phenylethyl alcohol, and ethyl decanoate in beer samples from the three types of fermentation [29,30].
Even though TDS, Econd, and salt concentration are not usually measured in beer, these are an indicator of the minerals content, especially from water, as this is the main ingredient in beer, and its hardness (minerals) level is crucial to determine the final product's sensory attributes. For example, hard water with a high concentration of iron used for brewing has been associated with off-flavors and discoloration in beer [31]. In this study, it was found that most spontaneous fermentation beers were higher in these three components compared with top and bottom. This may be since lambic beers are produced in controlled environments and similar regions of Belgium, which makes it more likely to have a similar water composition. According to Jablonská et al. [32], soft water low in magnesium is usually used to brew lighter beers, while water with higher mineral content is used for dark beers. This coincides with the present study in which Z (dark beer) was the highest in TDS, Econd, and salt within the top and bottom fermentation categories.
According to the PCA, aromatic compounds such as esters (ethyl caproate, ethyl decanoate, ethyl laurate, and ethyl octanoate) had a positive relationship with the foaming parameters; this may be because the bubbles in the foam contain most aromatic volatiles, compared with the liquid phase, and when they start bursting gradually, these are released and perceived [33,34]. The relationship between Brix, o-tolualdehyde (cherry aroma), and "a" coincides with Abeytilakarathna et al. [35], who reported a correlation between Brix and red colors in red fruits, and Gonzalez Viejo et al. [19], who found a similar relationship in beer samples.
Even though it has been reported that ethyl ester overtones can be found between 1700 and 2300 nm [36] and alcohols may be found at around 2000 nm [37], the ML model using NIR inputs was not as accurate to predict aromas, as phenylethyl alcohol, ethyl caproate, and ethyl decanoate presented most of the outliers in the overall model (Model 1). In contrast, although Model 3 had the same number of outliers, these were fitted better in the regression line, this may be due to the relationships found in the PCA between the foam-and bubble-related parameters and the aromas, and to the form of measurement, as RoboBEER is based on a visual and volatiles (sensors) assessment, which is closer to the GC-MS principle, while NIR is based on their spectrum. Even though other studies have reported highly accurate ML models to predict pH using the 1600-2400 nm NIR range [28] due to the overtone of pOH (inverse to pH) in 1908 nm [37], in the models developed with beers, it was the parameter that presented the most outliers in Model 2. In contrast, in Model 4, pH had high accuracy, and this is due to its influence in foam formation and stability as, when proteins are closer to their isoelectric pH, they are able to form more viscous films and therefore increase foam stability [28,38,39]. Econd was the parameter with the most outliers in Model 4; however, as it is directly related to TDS, this may be easily corrected.
The higher accuracies and performance of the Models 3 and 4 are in accordance with other studies [20,[40][41][42][43][44], which have found that the use of specific parameters that are directly related to the targets have provided better results with more robust models than the use of raw NIR values. Hence, in Models 3 and 4, color, foam, and bubble parameters were used as these are directly influenced/related by/to all the variables used as targets, as shown in the PCA (Figure 3). Models 3 and 4 may be used as accurate, reliable, rapid, and cost-effective tools to predict a total of 12 parameters from aromas and other chemical data, which may ease the quality control and assurance within the production line. Furthermore, it may be used as part of the product development to screen the samples and select those with the highest quality traits without the need to take all samples to laboratory analyses, which tend to be time-consuming and more expensive due to the equipment and consumables required.

Conclusions
Relationships between the color-and foam-related parameters of beers and their volatile aromatic compounds, as well as other physicochemical measurements such as pH, salt, Brix, and total dissolved solids, among others, were found. Based on these findings, the models with an AI approach were developed for the rapid and accurate assessment of commercial beers. The models that were based on low-cost robotics and sensors were more accurate than those produced based on NIR spectroscopy. These results are very encouraging since robotics and sensors used in this study are significantly less expensive compared with the NIR instrumentation used (10% of NIR retail price), which can be readily implemented in the breweries as a portable device rather than sending samples to specialized laboratories. Although these models may still be improved by feeding them with data of more samples/brands, these may already be implemented at the end of the brewing process and as a rapid assessment of small trials to fine-tune specific requirements in terms of aroma profiles and chemometrics that are better adjusted to consumer preferences or beer styles. Limitations of this study are based on further model construction for other specific aromas and chemometrics, which require objective measurements using GC-MS or NIR spectrometry. However, this required information can be obtained through the collaboration with research institutions or obtained from commercial laboratories. Further studies may focus on the attachment of an electronic nose to the RoboBEER for the assessment of off-flavors and off-aromas for the early detection of faults in the product within the different stages of production to obtain a near real-time assessment of beers in terms of aroma profiles, common fault detection, and liking of consumers.
Supplementary Materials: The following are available online at http://www.mdpi.com/2311-5637/6/2/56/s1, Table S1. Mean values of the RoboBEER foam and color parameters with letters of significance (a-k) according to the ANOVA and Fishers least significant difference post hoc test (α = 0.05). Abbreviations of the samples are found in Table 1; Table S2. Mean values of the peak area of the aromatic volatile compounds with letters of significance (a-l) according to the ANOVA and Fishers least significant difference post hoc test (α = 0.05). Abbreviations of the samples are found in Table 1; Table S3. Mean values of the chemical data with letters of significance (a-q) according to the ANOVA and Fishers least significant difference post hoc test (α = 0.05). Abbreviations of the samples are found in Table 1.