Low-Cost Methods to Assess Beer Quality Using Artificial Intelligence Involving Robotics, an Electronic Nose, and Machine Learning

: Beer quality is a difficult concept to describe and assess by physicochemical and sensory analysis due to the complexity of beer appreciation and acceptability by consumers, which can be dynamic and related to changes in climate affecting raw materials, consumer preference, and rising quality requirements. Artificial intelligence (AI) may offer unique capabilities based on the integration of sensor technology, robotics, and data analysis using machine learning (ML) to identify specific quality traits and process modifications to produce quality beers. This research presented the integration and implementation of AI technology based on low-cost sensor networks in the form of an electronic nose (e-nose), robotics, and ML. Results of ML showed high accuracy (97%) in the identification of fermentation type (Model 1) based on e-nose data; prediction of consumer acceptability from near-infrared (Model 2; R = 0.90) and e-nose data (Model 3; R = 0.95), and physicochemical and colorimetry of beers from e-nose data. The use of the RoboBEER coupled with the e-nose and AI could be used by brewers to assess the fermentation process, quality of beers, detection of faults, traceability, and authentication purposes in an affordable, user-friendly, and accurate manner. = − 0.22) and large (FL = − 0.23) bubbles on the negative side.


Introduction
Beer quality is usually regarded as a subjective concept that can be described as more objectively based on beer quality traits through physicochemical analysis and/or sensory analysis of beers using either trained panels or consumer tests, the latter for perceived quality. However, by themselves, parameters and tests may not describe specific quality traits related to the overall liking of beer and the complexity of consumer perception.
Based on the latest research, beers' physicochemical analysis has been mainly based on the bioactive compounds in craft beers [1], volatiles, and antioxidant properties when adding fruit using gas chromatography/mass-spectroscopy (GC-MS) and high-performance liquid chromatography (HPLC) [1][2][3]. Many other studies coupled these analyses of quality traits with sensory trials when analyzing processes to change beer characteristics, such as ultrasound-assisted thermal processing [4], antioxidant activity through natural additives [5][6][7], for sweet potato beers [8] and commercial beers [9]. In the case of traditional consumer sensory tests, they tend to be subjective, and require a laboratory with individual booths that meet specific requirements; it also involves the recruitment of a large number of participants, which often requires an incentive to participate, which leads to higher costs and time for conducting the sessions and analyzing the data [10][11][12]. Therefore, all these studies' translational results are not easy to implement in the broad brewing industry to be used in every single batch since they require laboratory instrumentation, specialized personnel, and skills for operation, data acquisition, and analysis and may be time-consuming and costly.
Many non-invasive technologies have been proposed for the analysis of beer quality traits, such as the implementation of robotics coupled with sensors and computer vision capabilities like the RoboBEER [13], with a similar approach applied for sparkling wines analysis though the FIZZEyeRobot [14] constructed with more ubiquitous components, making them more applicable to bigger brewing companies than to craft beer enterprises. Other non-invasive technologies based on near-infrared spectroscopy (NIR) have also been applied within the beer production process from fermentation analysis [15] and coupled with artificial intelligence (AI) to predict relative protein content of commercial beers [16], beer quality assessment [17], the effect of sonication on beer quality [18] and many other applications within AI [19]. More recently, an integrated gas sensor technology application has resulted in the development of a low-cost electronic nose (e-nose) that can be attached to robotics (i.e., RoboBEER) to assess aroma profiles [20] also implementing AI [21].
The implementation of e-noses for beer research is not new in the food science field as they have been used to assess aromas in products such as coffee acidity [22], and roasting level prediction [23], tea quality grading [24][25][26], classification of strawberry juices [24], assessment of wine smoke taint [27] and alcohol content [28], beer quality classification and aging [29][30][31], beer aroma prediction [20], meat quality and shelf life [32,33], olive oil origin and quality [33,34], milk spoilage [35], and rice infestation [36], among others. However, most of the e-noses used in those studies are expensive and need to be installed in a laboratory as they have a similar system to a gas chromatograph (GC), and/or are considered as low-cost compared to a GC, but still, cost ≥ USD 30,000 and require maintenance [37][38][39]. There have been some works using them for classification of beers using data-mining methods [40][41][42][43], to evaluate the water use in the brewing process [44], aroma discrimination [45], alcohol content [46], comparison of volatile compounds against gas chromatography methods [43]. However, there has not been an integration of these e-noses with low-cost robotic systems to uniform pouring conditions or comparing results with sensory analysis using machine-learning methods. This paper proposed an integrated low-cost AI system integrating robotics (RoboBEER), NIR spectroscopy, a newly developed e-nose, and sensory analysis to assess automatically the type of fermentation of beers (Model 1) based on e-nose data, sensory perception of beers based on NIR data (Model 2) and e-nose data (Model 3) and beer foamability parameters based on e-nose data (Model 4). All models presented high accuracy (R > 0.90) in the prediction of beer targets before they were mentioned. The integrated AI system proposed would offer brewers critical information based on robotics and e-nose data related to the type of fermentation of beers that will help traceability and identification, analysis of consumer acceptance, and bubble and physical foam properties of beers. All this information would be possible with low-cost robotics and instrumentation, which could be affordable even to small brewing companies that may give them reliable and critical information to tailor their beers according to specific consumer expectations. Furthermore, the proposed e-nose and AI system offers the advantage of being versatile and may be adapted to be used for different purposes, such as the assessment of smoke taint in wines and berries [27].

Sample Description
A total of 20 different beer samples from the three types of fermentation (seven top, six bottom, and seven spontaneous) were analyzed in triplicates (three bottles of each; n = 60). The top fermentation samples consisted of beers from the abbey ale, porter, kölsch, red ale, steam ale, aged ale, and sparkling ale styles. The bottom fermentation samples involved beer styles such as pale lager, Vienna lager, and German pilsner. On the other hand, spontaneous fermentation samples consisted of different lambic flavors and a wild Saison style. More details on the specific samples are shown as supplementary material (Table S1).

Electronic Nose (E-nose)
A low-cost and portable electronic nose (e-nose; Figure 1) developed by the Digital Agriculture Food and Wine (DAFW) Group from the Faculty of Veterinary and Agricultural Sciences (FVAS) of the University of Melbourne (UoM) was used. This e-nose, which is composed of nine different gas sensors (Table 1), is sensitive to different gases related to volatile aromatic compounds. It measures the signal from all sensors in volts to obtain all outputs in the same scale The readings were performed by placing the e-nose on a 500 mL beaker with each bottle's entire content; the e-nose started recording during the pouring of the sample and was placed on top of the beaker to collect readings for 3 min [20,27]. The e-nose was calibrated for 1-2 min between samples to ensure no carryover effects. All samples were measured at refrigeration temperature (4 °C), which is the consumption temperature and the same as used for sensory and physicochemical analysis.

Sensory: Consumer Acceptance Test
A sensory session was conducted with frequent beer consumers (n = 31) recruited from the staff and students at UoM, Australia. According to the Power analysis performed using SAS ® v. 9.4 (SAS Institute, Cary, NC, USA), the number of participants was enough to find significant differences (1β > 0.99). Participants were asked to sign a consent form approved by the FVAS-UoM Human Ethics Advisory Group (Ethics ID: 1545786.2). The session was conducted in individual sensory booths at the sensory laboratory of the FVAS-UoM. The samples were served at refrigeration temperature (4 °C) in standard wine-tasting glasses. Samples were served in a semi-randomized order (two groups of beers). Participants were provided with water and water crackers to cleanse their palates and were asked to rest for a few minutes between samples to avoid fatigue. The questionnaire was displayed in the BioSensory Application (University of Melbourne, Parkville, Victoria, Australia, [47]). The sensory attributes evaluated for acceptability and the scale used are shown in Table 2.

Near-Infrared Spectroscopy
Samples were analyzed using a NIR spectroscopy handheld device MicroPHAZIR™ RX Analyzer (Thermo Fisher Scientific, Waltham, MA., USA) able to read spectra from 1596-2396 nm. Gonzalez Viejo et al. [29] described a filter paper soaked with the beer sample and measured using the NIR device. The dry filter paper absorbance values were subtracted from the filter soaked in beer readings to obtain only the liquid's absorbance values.

Physical Parameters
The beer samples were analyzed using the robotic pourer RoboBEER (The University of Melbourne, Parkville, Vic, Australia), as Gonzalez Viejo et al. [10] described. Each beer bottle was poured using the pourer to record 5-min videos and further analyzed using computer vision algorithms in Matlab ® R2020b (Mathworks, Inc., Natick, MA., USA) to obtain the physical parameters related to foam and color (Table 3).

Statistical Analysis and Machine-Learning Modeling
A multivariate data analysis based on principal component analysis (PCA) was conducted using a code written in Matlab ® R2020a to find relationships between the data obtained from the e-nose, RoboBEER, and the consumer test responses. Furthermore, a correlation matrix was developed using Matlab ® R2020b to assess only the significant correlations (p < 0.05) between all parameters.
For machine-learning Model 1, pattern recognition, artificial neural networks (ANN) were used. This model consisted of the use of the maximum (Max), mean, and area under the curve (AUC) values of each sensor's outputs from the e-nose to classify the samples into the three types of fermentation (top, bottom, and spontaneous; Figure 2a). A total of 17 different training algorithms were tested in a loop using a code written in Matlab ® R2020a to find the best model based on the lack of under-or overfitting, highest accuracy, and best performance (Levenberg-Marquardt). Data were divided randomly as 60% for training, 20% for validation with a mean squared error (MSE) performance algorithm, and 20% for training. A neuron trimming test was conducted using 3, 5, 7, and 10 neurons, with the latter resulting in the best performance with no signs of under-or overfitting.
Models 2-4 were developed using a regression ANN, similar to Model 1; 17 different training algorithms were tested, with Levenberg-Marquardt resulting in the best performance and accuracy for the three models. Model 2 was developed using the NIR absorbance values from the whole spectra (1596-2396 nm) as inputs, while Model 3 was created using the Max, mean, and AUC values of each sensor's outputs from the e-nose as inputs. For both models, the consumer test responses for the five attributes shown in Table 2 were used as targets (Figure 2b). On the other hand, Model 4 used the same e-nose inputs as Model 3, but with the RoboBEER outputs (Table 3) as targets (Figure 2c). A random data division was used as 60% for training, 20% for validation with an MSE performance algorithm, and 20% for testing. For these models, a trimming exercise was also performed using 3, 5, 7, and 10 neurons, with the latter resulting in the best performance with no signs of under-or over-fitting.

Multivariate Data Analysis
As shown in Figure 3a, the PCA principal component one (PC1) explained 33.06% of total data variability, while PC2 accounted for 22.37% (total PC = 55.43%), which is close to the cut-off point of 60% [48]. According to the factor loadings (FL), the PC1 was mainly represented by the e-nose sensors MQ138 (FL = 0. were observed between the e-nose sensors and physical parameters such as total lifetime of foam (TLTF) and MaxVol as well as liking of all sensory attributes, especially aroma. By contrast, the enose sensors had a negative correlation with foam drainage (FDrain). Samples from bottom fermentation were associated with lower voltage from the e-nose and with FDrain. In comparison, most top fermentation and three spontaneous fermentation beers were associated with higher voltage from the e-nose and the sensory attributes' liking. The other four spontaneous fermentation beers were more associated with the physical parameters such as bubble size and lifetime of foam (LTF) and 'a' and 'b' from the CIELab color scale. Figure 3b shows the correlation matrix with all physical, sensory, and e-nose parameters. Positive and significant correlations (p < 0.05) were found between the sensory attributes' liking and e-nose sensors MQ8, MQ136, and MQ138. Furthermore, positive and significant correlations were found between physical parameters such as LTF, color ('a', 'b', and B), MedBubb, and the e-nose data. As expected, beer foam drainage (FDrain) was inversely correlated to maximum volume (MaxVol) and the total lifetime of foam (TLTF).

Machine-Learning Modeling
In Table 4, it can be observed that there was a high overall accuracy (97%) in predicting the type of beer fermentation using the Max, mean, and AUC data from the e-nose outputs as inputs. Furthermore, all stages had an accuracy of >90%. Compared to the validation and testing, the lower MSE value of the training stage and the latter two being the same, are indicators of no under-or overfitting. Figure 4 shows the receiver operating characteristic (ROC) curve depicting the truepositive (sensitivity) and false-positive (specificity) rates; as can be observed, the three categories had a sensitivity >0.90.   Table 5 shows the statistical data from the regression models. It can be observed that Model 2 had a high overall correlation coefficient (r = 0.90) and a high slope (>0.85) for all the stages. The training MSE value (MSE = 0.02) was lower than the validation and testing, which is a sign of no under-or overfitting; however, the validation (MSE = 0.12) and training (MSE = 0.30) were not as close, which may indicate some overfitting. Model 3, developed using the e-nose outputs to predict sensory descriptors' liking, had a higher overall correlation coefficient (R = 0.95) than Model 2, which was constructed using NIR inputs to predict the same sensory descriptors. Furthermore, Model 3 had high slope values for all stages. The training performance MSE value was lower than the validation and testing, and these two were close (validation MSE = 0.15; training MSE = 0.13); therefore, there were no signs of under-or overfitting. On the other hand, Model 3, developed using the e-nose outputs as inputs to predict the physical parameters obtained using RoboBEER, also had high overall accuracy (r = 0.93) with moderate-high slope values. This model had close MSE values for validation (MSE = 0.10) and testing (MSE = 0.20) and with the training stage having a lower value (MSE = 0.02), therefore, no signs of under-or over-fitting.  Figure 5 shows the overall regression models with their respective R values and regression equation. According to the 95% confidence bounds, Model 2 had 5% (15 out of 300 observations) of outliers, while Model 3 had 7% (21 out of 300 observations). On the other hand, Model 4 presented 5.3% (41 out of 780 observations) of outliers. It can be observed that in Model 2, flavor liking and carbonation mouthfeel were the attributes with the highest number of outliers (4 out of 60 each), while bitterness and aroma had the lowest (2 out of 60 each). In Model 3, bitterness was the highest in outliers (8 out of 60), while aroma was the lowest (1 out of 60). Conversely, in Model 4, 'a' and FDrain had the highest number of outliers (7 out of 60 each), while SmBubb did not present any outlier, and MedBubb only had 1 outlier out of 60.

Relationships between E-Nose and Physicochemical Analysis
Most of the bottom fermentation beers were clustered close to vectors related to foam drainage (FDrain) of beers and color red, green and blue (RGB) and L; the latter may be explained due to the lighter color that these beers tend to have [49] compared to those form top and spontaneous fermentation. Furthermore, the spontaneous beers were grouped mostly close to bubble formation with the distribution of bubbles between small, medium, and large size (SmBubb, MedBubb, and LgBubb) contributing to a higher lifetime of foam (LTF), similar results have been previously reported for both physicochemical and sensory data [10,13,50,51]. On the other hand, top fermentation beers clustered mostly closer to all the gas sensors' sensitivity with a variation of foamability and bitterness which mainly influenced overall aroma, and flavor liking along with higher beer carbonation mouthfeel (Mcarb) (Figure 3a). The reason for top fermentation beers to be spread along the PCA may be mainly due to the variability in the bitterness and flavor due to the addition of different types and amounts of hops, which is greater than that in the bottom, and spontaneous fermentation beers [10,52,53].
Most of the gas sensors from the e-nose were related to each other as expected. Still, more importantly, there were statistically significant and positive correlations between sensors from the enose and carbonation sensation and bitterness, which can be directly related to the CO2 release from beers in the pouring and aromas related to hops giving bitterness taste on beers [13,54] (Figures 2a  and 3b), which directly influenced the flavor and overall liking from the sensory analysis. Furthermore, there were also significant and positive correlations between the e-nose sensors and the lifetime of foam and blue to yellow colors (b) from CIELab and blue (B) from the RGB color scales (Figure 2b). The latter may be explained since volatile compounds such as hydrogen sulfide (MQ136) are present in the malt and hops, which are responsible for beer color [49,55]. Furthermore, hydrogen sulfide (MQ136), alcohol (MQ3, MQ135, MQ138), and hydrogen are produced during fermentation in which a drop in pH is caused, provoking a change in color intensity [49,56,57].
There are significant correlations between small bubbles (SmBubb) and liking, which were directly related to the lifetime of foam (LTF) and retention of foam of beers, hence decreasing the release of gases after pouring, which can explain the absence of correlation between small bubbles and the e-nose gas sensors. Furthermore, correlations between LTF and SmBubb with 'a' from CIELab scale were found; this may be explained with the findings in other studies showing that beers and berries with more red color had higher sugar content [50,58], and at the same time sugars act as surfactant substances, which are responsible for increasing beer's viscosity and, therefore, increasing foam stability and reducing bubble size [13,17,59].

Artificial Intelligence Applied to Beer Quality Assessment
The machine learning-based Model 1 was able to classify all the beers studied into the top, bottom, and spontaneous fermentation with very high accuracy (97%) using data from the e-nose. The latter is consistent with the data from multivariate data analysis presented here (Figures 2a and  2b) and previous research using data from the RoboBEER as inputs to classify beers into the three types of fermentation with similarly reported accuracies of 92.4% [13]. These results are important since, for this specific type of application related to beer classification, data analysis is based on the signal analysis in the case of the e-nose compared to more complex implementation of computer vision algorithms in the case of RoboBEER. Furthermore, the e-nose could offer additional gas classification capabilities and identification of the specific gases that every sensor is sensitive to and aroma profiles from beers [20,27,29,31,60]. Further applications could be focused on identifying faults and proteins in beers [16] and traceability using new and emerging sensor technologies [61].
The use of the e-nose could also be more efficient, cost-effective, and user-friendly than NIR spectroscopy methods, as per the results shown here to assess consumer sensory perception and acceptability of beers, which resulted in Model 3 having higher accuracy (e-nose) compared to Model 2 (NIR). Finally, Model 4, based on e-nose inputs, was shown to be highly accurate at detecting physical parameters of foam formation, drainage, size, and distribution of bubbles and colorimetric assessment of beers compared to the RoboBEER. These results are very encouraging when aligned to Model 1 since this makes it possible for the RoboBEER to act just like a precise pouring device to be attached to the e-nose to obtain all the required physicochemical, colorimetric, and sensory perception by consumer parameters for a more accurate, objective, cost-effective and user-friendly beer quality assessment system. Furthermore, the e-nose may be installed as a stand-alone device at different stages of the production line to assess beer quality and detect any faults in real-time to take corrective actions in the processing line before the final product. These parameters obtained from the new system proposed here can be used as an integrative system coupled with blockchain for traceability and authentication of beers [62,63].

Conclusions
A novel system based on artificial intelligence (AI) has been proposed using robotics, electronic sensors (e-nose), and machine learning to assess beer quality more objectively. The system proposed here offers high accuracy in identifying beer fermentation, consumer preference, and acceptance, as well as physicochemical and colorimetric analysis. Furthermore, it potentially could be used for authentication and traceability coupled with blockchain technology for higher transparency within the brewing chain from raw materials, brewing, quality assurance, and sensory analysis, to commercialization. Finally, the integration of low-cost technology with AI makes it possible to apply these new and emerging technologies to the broad spectrum of brewing processes and brewing companies, from craft beer enterprises to the biggest brewers.
Supplementary Materials: The following are available online at www.mdpi.com/2311-5637/6/4/104/s1. Table S1. Style of the beer samples used for the study including their country of origin, fermentation type and alcohol content.