Prediction of the Temperature of Liquid Aluminum and the Dissolved Hydrogen Content in Liquid Aluminum with a Machine Learning Approach

In aluminum casting, the temperature of liquid aluminum and the dissolved hydrogen density are crucial factors to be controlled for the purpose of both quality control of molten metal and cost efficiency. However, the empirical and numerical approaches to predict these parameters are quite complex and time consuming, and it is necessary to develop an alternative method for rapid prediction with a small number of experiments. In this study, the machine learning models were developed to predict the temperature of liquid aluminum and the dissolved hydrogen content in liquid aluminum. The obtained experimental data was preprocessed to be used for constructing the machine learning models by the sliding time window method. The machine learning models of linear regression, regression tree, Gaussian process regression (GPR), Support vector machine (SVM), and ensembles of regression trees were compared to find the model with the highest performance to predict the target properties. For the prediction of the temperature of liquid aluminum and the dissolved hydrogen content in liquid aluminum, the linear regression and GPR models were selected with the high accuracy of prediction, respectively. In comparison to the numerical modeling, the machine learning modeling had better performance, and was more effective for predicting the target property even with the limited data set when the characteristics of the data were properly considered in data preprocessing.


Introduction
Quality control of molten metal is becoming increasingly crucial in the foundry industry as the rigorous demand for the specification is requested from the customers. The final quality of the casting products is greatly affected by the characteristics of the molten metal [1][2][3]. In order to control the casting defects of aluminum products, such as porosity and shrinkage cavity, it is particularly important to control the temperature of the liquid aluminum and the dissolved hydrogen content in the liquid aluminum during the melting process [4][5][6][7][8].
The temperature of the liquid aluminum can significantly affect the quality of the final product. If the pouring temperature is not sufficiently higher than the liquidus temperature, the fluidity of the liquid aluminum deteriorates and the defects such as blowholes or insufficient filling are likely to occur. If the temperature of the liquid aluminum is superheated over 800 °C, the oxidation reaction at the melt surface is promoted with the increase of the impurities or cracks. In addition, it is essential to control the temperature of the liquid aluminum efficiently in order to minimize the temperature loss [9,10]. The dissolved hydrogen content in the liquid aluminum should be also carefully controlled to meet the high-quality inspection [11][12][13]. Remarkably, hydrogen gas can be dissolved in the liquid state of aluminum, and the dissolved hydrogen in the molten aluminum remaining after the solidification will cause the defects such as pores or microporosity. Also, the dissolved hydrogen in excess of the solubility limit in liquid aluminum during solidification will come out of solution and diffuse into the bifilm gap. Finally, this bifilm defect can work as crack initiators and deteriorate the mechanical property of the casting products [14]. Therefore, it is important to control the temperature of liquid aluminum and the dissolved hydrogen content in the liquid aluminum during the melting process.
In earlier works, various models have been proposed to predict the temperature of the liquid aluminum based on the empirical [15,16] and numerical [17][18][19] approaches. Wang et al. examined the computational fluid dynamics(CFD)-Taguchi combined method for the design of process parameters to optimize the aluminum melting [16]. To understand the melting behavior of the liquid aluminum by each process parameter, Quintana et al. [17], Nieckele et al. [18], and Bulin' ski et al. [19] proposed the numerical solutions considering the heat transfer and the flow behavior based on the process parameters. Numerous studies on the quantification of the dissolved hydrogen content in the liquid aluminum have also attracted much attention from researchers for a long time [11,[20][21][22][23][24][25][26]. Various melt treatments to control the dissolved hydrogen content in the liquid aluminum such as gas bubbling filtration (GBF) [20,21], degassing agent [22,26], and ultrasonication [24,25,27] have been introduced. Among these techniques, the GBF is one of the most effective processes, which has an obvious effect on degassing of hydrogen in the liquid aluminum with minimizing the melt loss and the dross formation. Previous studies have reported on the effect of process parameters such as the GBF processing time, GBF rpm, and the type of impeller on the dissolved hydrogen content in the liquid aluminum [20,21,28,29].
Both the empirical and numerical approaches to evaluate the temperature of the liquid aluminum or the dissolved hydrogen content in the liquid aluminum can provide the understanding of the melt property or the flow behavior, but the limitations still exist: difficulty to establish the empirical model between the process parameters and the melt properties due to the non-linear relationship, and the limitation in the application of the derived model when new experimental data set is added or the boundary condition is changed.
Recently, the machine learning (ML) models have been used as an alternative way to overcome the limitations in the empirical and numerical models to successfully predict the material properties [30][31][32]. It has become increasingly popular with advantages of being able to quickly solve the problems compared to other models based on the empirical and numerical approaches, and has the strong ability to deal with discrete data. In some researches, the ML models have already been adapted for predicting the melt temperature [33,34] and the porosity [35,36] in various materials including the aluminum alloys. However, the ML model of the temperature of the liquid aluminum and the dissolved hydrogen content in the liquid aluminum based on the experimental data, with consideration of the combination of process parameters, has not been sufficiently proposed.
The present study focuses on developing the machine learning models for predicting the temperature of the liquid aluminum and the dissolved hydrogen content in the liquid aluminum based on the experimental data. The process parameters were selected based on the main factors that affect the target properties. Experiments were carried out under the various combinations of process parameters and experimental data were preprocessed to be used in the machine learning models. For the prediction of the temperature of the liquid aluminum and the dissolved hydrogen content in the liquid aluminum, five types of machine learning models (linear regression, regression tree, Gaussian process regression (GPR), Support vector machine (SVM), and ensembles of regression trees) were investigated with different options. The developed machine learning models have been compared using various statistical values through the new data set, and the performance of the developed machine learning model is also compared to that of the numerical model.

Materials and Methods
The material used in the present study was pure aluminum ingot (>99.7 wt.%), and aluminum molten metal was produced in a high-frequency melting furnace. The main process parameters affecting the melt temperature and the dissolved hydrogen content in the liquid aluminum were selected, and the parameter studies were conducted under the various combination of experimental conditions to construct the data set for developing of the machine learning models as listed in Table  1. The temperature of the liquid aluminum was measured by k-type thermocouples. The applied electric power use during melting process was monitored using a real-time energy monitoring system (BMT Co., Ltd., Yangsan, South Korea). In the GBF process, the argon gas was selected as an inert gas. The dissolved hydrogen content in the liquid aluminum was measured by HYCAL (EMC Hycal Limited, Stafford, UK), which is a real time analyzer.

Data Acquisition
The temperature of liquid aluminum during the melting process is strongly influenced by the input electric power condition, the weight of ingot, and the initial temperature of the liquid aluminum. At different power conditions of 15, 20, 25, and 30 kW, the temperature of the liquid aluminum was measured during the application time of electric power in the form of the time series data. The temperature of the liquid aluminum was also measured for different ingot weights of 4, 6, and 7 kg. The dissolved hydrogen content in the liquid aluminum is closely related to the process parameters of the GBF treatment condition, the temperature of liquid aluminum, and the initial hydrogen concentration. Under the fixed GBF rpm of 1510, a gas flow rate of 2, 4, 6, and 7 cc/min was set as variables. The temperature of liquid aluminum was also considered as a variable with 700, 730, 740, 760, 770, 790, and 800 °C being the selected temperatures. The dissolved hydrogen content was also measured during GBF treatment time in the form of the time series data. Figure 1 demonstrates one example of the data set to be used for developing machine learning model to predict the temperature of the liquid aluminum and the dissolved hydrogen content in the liquid aluminum.

Data Acquisition
In this work, the machine learning approach involved the data generation process. The generated data comes from the original data set measured by the experiments according to the sliding time window method, which is regularization technique known to improve model performance [37][38][39]. Here, the sliding time window method was implemented in both the temperature of the liquid aluminum and the dissolved hydrogen content in the liquid aluminum.
For the temperature of the liquid aluminum, a window size ( , = 1-9) was chosen as 5, 10, 15, 20, 25, 30, 40, 50, and 60 s. The input ( ) and output ( ) data set for training, validating, and testing were composed as follows: {Electric power, Ingot weight, , } and represents the data of start point of the temperature of the liquid aluminum before sliding the window, represents the temperature of the liquid aluminum after sliding the window of , means the step size which is a constant of 3. From the sliding time window method, the number of the training, validating, and testing data set of the temperature of the liquid aluminum was prepared as 6067.
In the case of the dissolved hydrogen content in the liquid aluminum, a window size ( , = 1-10) was chosen as 0.5, 1, 1.5, 2, 2.5, 3, 5, 7.5, 10, and 12.5 min. The input ( ) and output ( ) data set for training, validating, and testing were composed as follows: {Gas flow rate, GBF rpm, Melt temperature, , } and { } ( =1,2,3,…), where represents the data of start point of the dissolved hydrogen content before sliding the window, represents the dissolved hydrogen content after sliding the window of , means the step size which is a constant of 1. After conducting the sliding time window method, the number of training, validating, and testing data set of the dissolved hydrogen content in the liquid aluminum was prepared as 5974. Note that this data generation process increases the amount of input data set in number, and it is originated from the original experimental data, not an artificial or imaginary data.

Machine Learning Model
The prepared data set was imported into MATLAB as an excel file format. The statistics and machine learning toolbox was used in this work, which provides the functions and apps to describe, analyze, and model data [40,41]. The toolbox provides the supervised machine learning algorithms such as support vector machine, boosted and bagged decision tree, k-nearest neighbor, and Gaussian mixture models etc.
In this work, the machine learning models of linear regression models, regression trees, Gaussian process regression models, support vector machines, and ensembles of regression trees were investigated to predict the temperature of the liquid aluminum and the dissolved hydrogen content in the liquid aluminum.
In general, the linear regression model can be described by the form where is the ith response; is the kth coefficient ( is the constant term in the model); is the ith observation on the jth predictor variables (j 1, ⋯ , ); is the ith noise term for random error and is a scalar-valued function of the independent variables ( ), which might be in any form including nonlinear functions or polynomials [42][43][44]. We used four different types of linear regression models (linear, interaction linear, robust linear, and stepwise linear) to confirm which setting produces the best result with the data. We chose the linear term for linear and robust linear models and the interactions term for interaction linear model. For the stepwise linear model, we set the linear, interactions and 1000 for initial terms, upper bound on terms and maximum number of steps, respectively.
The regression trees are one of the nonparametric supervised learning algorithms with low on memory usage and the standard Classification And Regression Tree(CART) algorithm is used by default. [44,45] In order to avoid overfitting, the smaller trees with fewer larger leaves can be tried first and then the larger trees are considered. We tested three different types of regression tree model (fine tree, medium tree, and coarse tree) with different minimum leaf sizes. In general, a fine tree with small leaves shows higher accuracy on the training data but it might not show comparable accuracy on an independent test set. In contrast, a coarse tree with large leaves does not give high accuracy for the training data but its training accuracy can be applied to a representative test set of data [41]. The regression trees which we used in this work were binary and each step in a prediction involved checking the value of one predictor variable. The minimum leaf size was 4, 12, and 36 for fine, medium, and coarse trees, respectively.
The Gaussian process regression (GPR) models are nonparametric kernel-based probabilistic models which explain the response by introducing latent variables, , 1,2, ⋯ , , from a Gaussian process (GP) and explicit basis functions. A Gaussian process is a set of random variables, having a joint Gaussian distribution, and is defined by its mean function and covariance function, , . When ~ 0, , ), that is are from a zero mean GP with covariance function, , , the joint distribution of latent variables , 1,2, ⋯ , in the GPR model can be described as follows in vector form: where , . The covariance function can be defined by various kernel functions, which can be parameterized in terms of the kernel parameters in vector , thus the covariance function can be expressed as , | [46,47]. In this work, we performed the prediction by using four different kernel functions such as rational quadratic, exponential, squared exponential, and matern 5/2 kernels. The detailed kernel functions are listed in Table 2.

√5
The support vector machine (SVM) regression is another nonparametric technique. The SVM finds the support vectors having a maximum margin after classifying the collected data into clusters by using a hyperplane [48]. The best hyperplane is the one with the largest margin between the classes. The linear -insensitive loss function, , is determined based on the distance between observed value and the margin . The error within the margin ( of the observed value is ignored by treating them as zero as described below [41,49].
The SVM regression also relies on kernel functions and three different kernel functions such as linear, Gaussian, and polynomial were considered in this work. The details of the kernel functions are listed in Table 3. We performed the prediction with several models with linear, quadratic, cubic, fine Gaussian, medium Gaussian, and coarse Gaussian SVM to see the performance of each model. The kernel scales were set to √ /4, √ , 4√ for fine, medium, and coarse Gaussian SVM models, respectively, where is the number of predictors.

Kernel Name Kernel Functions
Linear , where is in the set 2, 3, ⋯ The ensembles of regression trees are multi-learning algorithm techniques that complement the individual machine learning algorithms, and the bagged tree and boosted tree are typical [50,51]. The bagged tree makes a decision by constructing the tree by training the variables that are composed by randomly extracting the same size from the independent variables, and the boosted tree reinforces the learning as a whole by adjusting the weight of the weak learning [46,52]. In this work, the minimum leaf size and number of learners were set to 8 and 30 for both methods, and the learning rate of 0.1 was used for the boosted tree model.
The architectures of the machine learning model to predict the temperature of the liquid aluminum and the dissolved hydrogen content in the liquid aluminum are shown in Figure 2. To build models for predicting the final temperature of the liquid aluminum after applying the electric power and the final dissolved hydrogen content after the GBF treatment, 5922 and 5773 sets of data were used as the training/validation data set, respectively. The five-fold cross-validation scheme was used to protect against overfitting for model trainings. We compared the models with different options in each model type and selected the models with the best performance for each model type, which are shown in Figures 3 and 6. The selected models were finally compared by using the new data set.  Figure 3 shows the scatter plots of the predicted values versus the experimental data of the temperature for the liquid aluminum with the machine learning models with the highest accuracy in each model type. The performance of the models seems to be similar as the coefficients of determination were close to 1 for all models; this means that the given data set of the temperature of the liquid aluminum was linear in nature. The statistical comparison between the original experiments and the predicted values by five different machine learning models revealed that most of characteristics of the original data were captured by the developed models. For example, the mean, median, minimum, maximum, and standard deviation from experimental data were 744.5, 743.1, 704,9, 787.1, and 19.2, respectively, and those for the predicted values by linear regression model were 744.9, 743.2, 705.6, 787.5, and 19.5, respectively. The statistics comparisons of other models are listed in Table 4. In Table 5, the evaluation of the performance of the five different regression models developed in this work are compared. The root mean square error for GPR model was the smallest and followed by the linear regression model. Since the original data and the predicted values had a strong linear correlation for the melt temperature of the liquid aluminum data set, the linear regression model can be a proper model to predict if the accuracy is sufficient, which is known as one of the simplest machine learning models [53,54]. Table 4. Comparison between the statistics of the predicted values using different machine learning models with that of the experimental data of the temperature of the liquid aluminum.  Figure 4 shows the probability distribution function (PDF) and cumulative distribution function (CDF) plots of new experiments and the prediction of the temperature of the liquid aluminum by the developed models. The PDF curves were fitted using the normal distribution option. The new experimental data in Figure 4 were obtained with 6 kg of aluminum ingot and 27 kW of electric power conditions under various times for electric power with 145 sets of data, which were not used for the development of machine learning model. The estimated parameters of the experimental data set from the normal distribution are listed in Table 6. In Figure 5, the comparison of measured values by experiments versus predicted values by linear regression model is shown with good agreement between the measurement and the predicted values with R 2 of 0.9994.

Dissolved Hydrogen Content in the Liquid Aluminum
The sets of scatter plots between the predicted values from the machine learning models with the highest accuracy in each model type and the experimental data of the dissolved hydrogen content in the liquid aluminum are shown in Figure 6. The statistical comparisons between the original experiments and the predicted values by five different machine learning models are presented in Table 7 and show that the predictions from the GPR model are in the best agreement with the experimental data. The mean, median, minimum, maximum, and standard deviation from experimental data are 0.1194, 0.115, 0.1, 0.22, and 0.0143, respectively, and those for the predicted values by the GPR model are 0.1194, 0.1149, 0.0999, 0.2175, and 0.0142, respectively. The coefficients of determination are over 0.93 except the linear regression model with the value of 0.8548, as shown in Table 8. Table 7. Comparison between the statistics of predicted values using different machine learning models with that of the experimental data of the hydrogen content in the liquid aluminum.  Figure 7 shows the probability distribution function (PDF) and the cumulative distribution function (CDF) plots of new experiments and the prediction of the dissolved hydrogen content in the liquid aluminum by the developed models. The PDF curves were fitted by using the lognormal distribution option, and the estimated parameters of the experimental data set from the normal distribution are listed in Table 9. The new experimental data in Figure 7 were obtained with 740 C of the temperature of the liquid aluminum and 6 cc/min of gas flow rate conditions under various treatment times in GBF with 201 sets of data, which were not used for the development of machine learning model. The PDF plot for the predicted values by the GPR model closely follow the actual measurements over a wide range of the hydrogen content, showing the left-shift shape of the fitting curve and covering high content region over 0.14 mL/100 g. The CDF in Figure 7g also shows that the curve by GPR model closely captured the original data curve, indicating that the GPR model was the most accurate model to predict the dissolved hydrogen content in the liquid aluminum compared to the other models considered in this work. Figure 8 shows the comparison of measured values versus the predicted values by the GPR model with good agreement each other overall range of data set.

Comparison of ML Model to Numerical Model
Based on the experimental results, a numerical model to predict final target properties of the temperature of the liquid aluminum and the dissolved hydrogen content in the liquid aluminum was investigated. Here, the numerical model was proposed using the raw data form without the data generation process used in constructing the machine learning model.
The temperature of the liquid aluminum had a linear relationship with the application time of electric power as shown in Figure 1a. The linear function was a form of , where is the slope and is the intercept of . The slope ( ) and intercept ( ) of linear relationship between the temperature of the liquid aluminum ( ) and the application time of the electric power ( ) depend on the experimental conditions. The slope and intercept are identified under all the experimental conditions, and one example is shown in Figure 9a under the electric power of 25 kW with the ingot weight of 4 kg. In particular, the most influential factors affecting the slope of this linear relationship were found to be the electric power and the ingot weight. Generally, the larger the weight of ingot, the higher level of electric power was required for melting of ingot. Therefore, the values of slope were plotted as a function of electric power/ingot weight (z, kW/kg) as shown in Figure 9b,  is the electric power/ingot weight. Using the test data set described in Figure 5, the temperature of the liquid aluminum was predicted based on the suggested numerical model, as shown in Figure 9. By comparing with the results predicted by the linear regression model from the ML approach, the numerical model showed a comparable performance of R 2 of 0.9961 with a simple assumption and approach, but the performance of numerical model was still lower than that of ML model. The dissolved hydrogen content in the liquid aluminum has the characteristics in which it converges over time as shown in Figure 1b. For this data type, it can be fitted well with a function of exp / , where is the dissolved hydrogen content, is the GBF time, , , and are the fitted parameters. Using all of the experimental data sets, the fitted parameters were obtained, and one example of a fitting result is described in Figure 10a. The temperature of the liquid aluminum and the gas flow rate are considered to the most influential factors affecting final dissolved hydrogen content. Therefore, , , and are plotted as functions of melt temperature and gas flow rate as shown in Figure 10b-d. In this case, it is hard to find the numerical relationship between the fitted parameters of , , and experimental condition at this state due to the limited number of data set and simple assumption. In addition, the parameter of the dissolved hydrogen content is complicatedly influenced by the experimental conditions compared to the temperature of the liquid aluminum, which shows relatively simple linear relationship depending on the experimental parameters. Therefore, it can be said that the machine learning model is more effective in predicting the data set with a non-linear type. Also, the prediction model using the machine learning approach can be obtained with the high level of performance through the data generation process considering the data characteristic, even in hard case of constructing the numerical model.

Conclusions
In this study, the temperature of the liquid aluminum and the dissolved hydrogen content in the liquid aluminum were predicted with a machine learning approach. The temperature of the liquid aluminum and the dissolved hydrogen content in the liquid aluminum were the time series data set, so the limited number of the experimental data was preprocessed to be used to develop the machine learning models based on sliding time window method. Five types of machine learning models, including linear regression, regression tree, GPR, SVM, and ensembles of regression trees, were constructed for predicting the target properties. In order to confirm model performance, the constructed machine learning models based on training/validation data set were tested with new experimental data sets. In the case of the temperature of the liquid aluminum, five kinds of machine learning models showed the comparable model performance, and the linear regression can be used with high accuracy. To predict the dissolved hydrogen content, the GPR model showed the highest level of accuracy of prediction. For comparison, the numerical model was also investigated. The temperature of liquid aluminum had linear relationship between the experimental parameters of electric power and ingot weight, and it can be predicted by simple numerical approach using the linear function. However, the performance of the numerical model to predict temperature of the liquid aluminum was still lower than that of developed machine learning model of linear regression. The numerical model to predict the dissolved hydrogen content can be hardly obtained due to the limited data set and the highly non-linear characteristic of data set between the dissolved hydrogen content and the GBF process conditions. In order to apply prediction of melt property with a machine learning approach in real industry, more data acquisition considering various processing parameters will be still required. Nevertheless, from this work, it can be suggested that the machine learning model can be effective for predicting the target properties with high accuracy, even with the limited data set, when the data preprocessing takes into account the characteristics of the data properly.