Comparison of Random Forest and Neural Network Framework for Prediction
  of Fatigue Crack Growth Rate in Nickel Superalloys
The rate of fatigue crack growth in Nickle superalloys is a critical factor
of safety in the aerospace industry. A machine learning approach is chosen to
predict the fatigue crack growth rate as a function of the material
composition, material properties and environmental conditions. Random forests
and neural network frameworks are used to develop two different models and
compare the two results. Both the frameworks give good predictions with $r^2$
of 0.9687 for random forest and 0.9831 for neural network.
Raghunandan Pratoori
Comparison of Random Forest and Neural Network Framework for Prediction of Fatigue Crack Growth Rate in Nickel Superalloys

###### Abstract

The rate of fatigue crack growth in Nickle superalloys is a critical factor of safety in the aerospace industry. A machine learning approach is chosen to predict the fatigue crack growth rate as a function of the material composition, material properties and environmental conditions. Random forests and neural network frameworks are used to develop two different models and compare the two results. Both the frameworks give good predictions with \(r^{2}\) of 0.9687 for random forest and 0.9831 for neural network.

## 1 Introduction

Superalloys are of great utility in the fields of engineering, especially in aerospace and power generation industries because of their excellent balance of mechanical and chemical properties [24]. These superalloy components are subjected to high operating stresses under cyclic loading. This makes fatigue behavior a very important factor to be considered. Fatigue is caused due to fluctuations in the mechanical and thermal loads in various stages of operation. The fatigue crack propagation is dependent on the various factors like environmental conditions, microstructure, composition of the material and the like [1, 18, 28, 2]. This makes a case for developing a model to predict the fatigue crack growth rate under various conditions.

Understanding the complexity of the phenomena, in this work, a machine learning approach is chosen to develop a model for the prediction of fatigue crack growth rate. Machine learning approaches are preferred in situation where calculation of some attributes exactly in real-time is not possible. Among the various available machine learning approaches, random forest and neural network frameworks are chosen. In the recent past, many researchers have used random forests in the field of material science to calculate properties of materials which need extreme experimental conditions to determine them, to establish a relationship between two or more material properties or to enhance the material design process.

Random forest has successfully been used to enhance the prediction accuracy in the fields of ecology [10, 26], remote sensing [9, 11, 15, 21], material science [6, 19, 31]. Carrete et al. used random forests to identify the compounds with low lattice thermal conductivity and the critical properties influencing the lattice thermal conductivity. With this approach, approximately 79,000 half-Heusler entries in AFLOWLIB.org database were scanned through with much ease, which would have been a high cost and time-consuming experimental challenge. Nagasawa et al. have used random forest to design organic photovoltaic materials and demonstrated its utility in the synthesis and characterization of the polymer. Vinci et al. have used random forest to investigate the mechanical properties of Ultra-High-Temperature-Ceramic-Matrix-Composites and also studied the influence of different parameters on different properties.

Neural networks are one of the popular machine learning techniques often used in a lot of applications such as pattern recognition [20, 25], image processing [23, 30], biotechnology [7, 13, 17], material sciences [2, 5, 14, 12, 29], etc. The accurate results obtained from it and the simple representation makes it applicable to almost all the areas of research. Kotkunde et al. have developed a neural network model enhanced with differential evolution algorithm to predict the flow stress values for Ti-6Al-4V alloy as a function of strain, strain rate and temperature. Hassan et al. have used neural networks in predicting the physical properties like density and porosity and hardness of aluminium-copper/silicon carbide composites as a function of weight percentage of copper and volume fraction of the reinforced particles. Singh et al. have developed a neural network model for predicting the effective thermal conductivity of porous systems filled with different liquids.
Methods

In this work, two different frameworks - random forest and neural network, are tried to predict the fatigue crack growth rate.

### Random Forest

Random Forest is an ensemble of \(n\) trees dependent on a \(p\)-dimensional vector of variables. The ensemble produces \(n\) outputs one for each tree, which are averaged to produce one final prediction (Figure 1).

The training algorithm proceeds as follows:

1. From the training data, draw a random sample with replacement (bootstrapping).
2. For each bootstrap sample, grow a tree choosing the best split among a randomly selected subset of variables until no further splits are possible.
3. Repeat the above steps until \(n\) such trees are grown.

Cross-validation is in-built in the training step of random forest with the use of Out-Of-Bag (OOB) samples [4].So, We can calculate an ensemble prediction \(Y^{OOB}\) by averaging only its OOB predictions. Calculate an estimate of the mean square error (MSE) for regression by

\[MSE=n^{-1}\Sigma_{i=1}^{n}\{Y^{OOB}(X_{i})-Y_{i}\}^{2} \tag{1}\]

Random Forest algorithm is capable of selecting important variables but does not produce an explicit relationship between variables and the predictions [3]. However, a measure of how each variable contributes can be estimated by measuring the node purity in the course of training.

### Neural Network

A neural network is made of neurons which combine all the inputs given to the neuron and transfers it to another neuron based on an activation function. Tan sigmoid, linear line and Log sigmoid are in general the popularly used activation functions or transfer functions. A group of neurons connecting together in a weighted form to give rise to output is called a layer of neurons. The layout of a single layer neural network is shown in Figure 2. The weights of each layer are evaluated by using a back propagation algorithm. The transfer function relating the inputs and the hidden layer is given by

\[h_{i}=\tanh(\Sigma_{j}w_{ij}^{(1)}x_{j}+\theta_{i}^{(1)}) \tag{2}\]

The relationship between the hidden units and the output is given by

\[y=\Sigma_{i}w_{i}^{(2)}h_{i}+\theta^{(2)} \tag{3}\]

## 3 Data

The data set used in this work is from published literature. This data set consists of 1894 data points for fatigue crack growth which is dependent on 51 input variables which can be categorized into stress intensity factor, temperature, microstructure, heat treatment, load waveform, type of crack growth, properties of the material and composition. The data is summarized as shown in Figure 3. A detailed account of all the input variables is described in!Fujii?. Type of crack growth is binary valued with short crack growth represented by 0 and long crack growth represented by 1. Since the problem here is modelled as a regression problem, type of crack growth is omitted in the analysis and hence only 50 variables are being used. Among the output variables, \(\log(da/dN)\) is chosen instead of \(da/dN\) to build a regression model, following the Paris' law [22].

## 4 Analysis

As can be observed from Figure 3, the range of the data varies significantly between the variables. To prevent any adversarial effect in determination of influence of the variables, both the input variables and output variables are normalized within the range [0, 1] as follows:

\[x_{N}=\frac{x-x_{min}}{x_{max}-x_{min}} \tag{4}\]
where \(x_{N}\) is the normalized value of \(x\), \(x_{min}\) is the minimum value of each variable and \(x_{max}\) is the maximum value of each variable of the original data. The normalized data is then analysed using the R [27] software using a random forest and neural network framework. 75% of the data is randomly selected for training the models and tested with the remaining 25% of the data.

### Random Forest

Random forest framework is developed using randomforest package [16]. All the 50 variables are used in the initial run, assuming a linear relationship between the input and the output variables. The maximum number of decision trees is chosen to be 1000 and the number of trees that give the least mean square error is selected for further analysis. Since there are a total of 50 variables, there is a chance of model overfitting the data and hence leading to a poor performance with the test data. To avoid this, the factors with low %IncMSE and IncNodePurity are omitted and again analysed in the same fashion as the initial run.

### Neural Network

Neural network framework is developed using neuralnet package. All the 50 variables are used in the initial run, assuming a linear relationship between the input and the output variables, just like in the case of random forest. In the initial run, only one hidden layer is considered with the number of nodes varying from 1 to 20. These models are trained on the training data and then applied on the testing data. The number of nodes with the highest \(r^{2}\) is selected and a new layer is added to it and the number of nodes are varied from 1 to 20. Again, these are applied on the testing data and the number of nodes with the highest \(r^{2}\) is selected. A sigmoid function is used as the activation function.

## 5 Results

### Random Forest

For the first run with all the 50 variables, the change in mean square error with increase in number of decision trees is shown in Figure 4. The least error is observed with a choice of 978 decision trees and a random forest framework is designed with the same. The number of variables tried at each split are 16. The mean squared residual obtained from this model is \(1.32\times 10^{-3}\). The percentage variance explained by this framework is 96.93%. This shows the model is a good fit for the training data. Using this framework on the testing data with and comparing with the original testing data, gives an \(r^{2}\) value of 0.9693. The correlation value of 0.9865 and p-value of \(<2.2\times 10^{-16}\) show there is a significant correlation with the chosen variables and the data. Figure 5 shows the comparison of the predicted values of \(\log da/dN\) to the original values. It can be clearly seen from Figure 5 that the points align close to the \(x=y\) line with major deviations present near the lower end. This shows that the model is not a good representation when the rate of crack growth is smaller. Figure 6 shows the distribution of the original and the predicted rate of crack growth. It can be clearly observed that the original data in the range (0, 0.1) has not been predicted accurately and even the data in the range (0.8, 1.0) has not been completely reproduced.

Table 1 shows the values of Mean Decrease Accuracy and Mean Decrease Gini sorted according to decreasing Mean Decrease Accuracy. The variables with low Mean Decrease Accuracy and Mean Decrease Gini are not significant and can be omitted. In this case, the variables with the Mean Decrease Accuracy less than 5 and Mean Decrease Gini less than 0.005 are omitted leaving us with 35 variables. For the final run, the same procedure is followed as that of the initial run. The change in mean square error with increase in number of decision trees is shown in Figure 7. The least error is observed with a choice of 189 decision trees and a random forest framework is designed with the same. The number of variables tried at each split are 11. The mean squared residual obtained from this model is \(1.31\times 10^{-3}\) and the percentage variance explained by this framework is 96.94%, which are very close to the values observed in the initial run. Using this framework on the testing data with and comparing with the original testing data, gives an \(r^{2}\) value of 0.9687 which is 0.06% lower than the initial run. The correlation value of 0.9862 and p-value of \(<2.2\times 10^{-16}\) show there is a significant correlation with the chosen variables and the data. Looking at the values of \(r^{2}\) and correlation coefficient, it can be attested that the omitted values are insignificant in determining the rate of crack growth. Figure 8 shows the comparison of the predicted values of \(\log da/dN\) to the original values. It can be clearly seen from Figure 8 that the points align close to the \(x=y\) line with major deviations present near the lower end similar to the initial run. This shows that the model is not a good representation when the rate of crack growth is smaller. Figure 9 shows the distribution of the original and the predicted rate of crack growth. Similar to the initial run, the prediction was not good at the extremes. Table 1 shows the values of Mean Decrease Accuracy and Mean Decrease Gini sorted according to decreasing Mean Decrease Accuracy for the random forest model with 35 variables.

### Neural Network

For the first run with one hidden layer has the best \(r^{2}\) value with 19 nodes in the hidden layer, when used for predicting the testing. The \(r^{2}\) value for this framework is 0.9831. The correlation value of 0.9916 and p-value of \(<2.2\times 10^{-16}\) show
there is a significant correlation with the chosen variables and the data. Figure 10 shows the comparison of the predicted values of \(\log da/dN\) to the original values. It can be clearly seen from Figure 10 that the points align close to the \(x=y\) line with major deviations present near the lower end similar to the initial run. This shows that the model is also not a good representation when the rate of crack growth is smaller, but slightly better than random forest. Figure 11 shows the distribution of the original and the predicted rate of crack growth. It can be clearly observed that the distribution of the predicted data is much closer to the original data, which is better than what we observed in the case of random forest.

For the second run with two hidden layers, the framework with 5 nodes in the second hidden layer has the best \(r^{2}\) value of 0.9847 which is only 0.16% better. This shows that adding another hidden layer does not significantly improve the performance of the neural net for being significantly computationally intensive for this data. So, a single hidden layer with 19 nodes is the best neural network framework for this data set.

## 6 Conclusions

In this work, the rate of fatigue crack growth in Nickel superalloys is estimated as a function of 51 available variables. Two different frameworks were used - random forest and neural network. Looking at the \(r^{2}\) values of the predicted data

\begin{table}
\begin{tabular}{|l|l|l|l|l|l|} \hline Variable & \%IncMSE & IncNodePurity & Variable & \%IncMSE & IncNodePurity \\ \hline Atm.Pressure & 72.645326 & 0.435396 & Cobalt\_wt.. & 13.21943 & 0.582949 \\ \hline delta\_K..MPa.sqrt.m.. & 50.245341 & 12.06703 & Nickel\_wt.. & 12.33514 & 0.26295 \\ \hline Frequency..Hz. & 48.807527 & 15.70495 & HT2.Temp..K. & 12.25707 & 1.019443 \\ \hline log10.delta\_K. & 47.736954 & 10.87632 & Titanium\_wt.. & 12.24269 & 0.513162 \\ \hline Yield\_Strength..MPa. & 44.850812 & 0.503051 & Unloading.Time\_s. & 11.82461 & 0.286359 \\ \hline Temp..K. & 35.091226 & 4.990744 & HT1.CoolingRate.. & 11.81688 & 0.057953 \\ \hline Min.Grain.Size..micro.m. & 29.230863 & 0.259286 & HT3.CoolingRate.. & 11.65292 & 0.027644 \\ \hline Max.Grain.Size..micro.m. & 28.139714 & 0.196492 & Niobium\_wt.. & 11.3235 & 0.084579 \\ \hline Loading.Time..s. & 27.477331 & 2.021161 & HT2.CoolingRate... & 10.97752 & 0.06581 \\ \hline HT1.Temp..K. & 26.732803 & 0.278611 & Manganese..wt.. & 10.45497 & 0.213812 \\ \hline Diff.in.GS. & 26.287002 & 0.095541 & Copper\_wt.. & 8.091316 & 0.031112 \\ \hline Chromium..wt.. & 26.195653 & 0.5403 & Phosphorus\_wt.. & 7.709504 & 0.033819 \\ \hline R.ratio & 23.602636 & 0.486236 & Sulphur..wt.. & 7.652882 & 0.020254 \\ \hline Thickness..mm. & 19.991276 & 0.589908 & HT1.Time..hrs. & 7.056421 & 0.160201 \\ \hline HT3.Temp..K. & 19.269015 & 0.077698 & Tungsten\_wt.. & 6.754946 & 0.01083 \\ \hline HT3.Time..hrs. & 18.495807 & 0.14059 & Tantalum\_wt.. & 6.463679 & 0.023136 \\ \hline Molybdenum\_wt.. & 17.562076 & 2.840485 & Yttrium.Oxide..wt.. & 5.813943 & 0.035488 \\ \hline Iron..wt.. & 17.265415 & 0.076556 & Silver\_wt.. & 4.174516 & 0.001748 \\ \hline Silicon..wt.. & 17.074731 & 0.123597 & Rhenium\_wt.. & 4.118154 & 0.00736 \\ \hline HT2.Time..hrs. & 16.238195 & 0.07077 & Lead..wt.. & 4.059671 & 0.003141 \\ \hline Load.Shape & 16.116972 & 0.546295 & Magnesium\_wt.. & 3.879866 & 0.002424 \\ \hline Boron..wt.. & 15.479676 & 2.378501 & Calcium\_wt.. & 3.761607 & 0.00224 \\ \hline Zirconium\_wt.. & 15.323161 & 0.382954 & Tin\_wt.. & 3.729041 & 0.001958 \\ \hline Carbon..wt.. & 14.446973 & 0.210651 & Hafmium\_wt.. & 3.342515 & 0.006146 \\ \hline Aluminium\_wt.. & 14.203788 & 0.13301 & Bismuth\_wt.. & 3.321477 & 0.001853 \\ \hline \end{tabular}
\end{table}
Table 1: Mean Decrease Accuracy (%IncMSE) and Mean Decrease Gini (IncNodePurity) of each variable in the initial run of random forest
using both the frameworks, the performance of neural network was only marginally better with 1.48% improvement. It can be concluded that for Nickel superalloys, both random forest and neural network frameworks work well, but random forest is recommended in terms of computational speed. Neural network, although give a better performance, is much more computationally intensive and does not justify the marginal increase in accuracy. But in case, an explicit model is preferred to understand the relationship between the variables and the output, neural network is preferred.
