# Using a Machine Learning Method to Predict the Penetration Depth of a Gravity Core
## 3 Application and Analysis
### Neural Network
#### 3.3.3 Hidden Layer  
The number of layers and nodes of hidden layers is significant in constructing neural networks. So far, no study has been able to arrive at the optimal number of hidden layers and nodes for a research problem. Therefore, when constructing neural networks for specific issues, it is necessary to try to obtain a more optimal network based on the parameters of the actual data. Therefore, 30 gravity sampling depth prediction models are constructed by varying the number of hidden layers from 1 to 30, with other conditions and model parameters unchanged. The four model accuracy check parameters mentioned in Section 3.2 are used for evaluation, and the best model is selected after a comprehensive comparison.  
To choose the most suitable number of hidden layer nodes, it is necessary to consider the accuracy of the model prediction results and the increase in computational cost caused by the rise in the number of hidden layer nodes. Therefore, a model with high accuracy and low computational cost is desirable. In terms of model prediction accuracy, the results can be seen in Figure 2. All four evaluation methods show the same trend. With the increase in the number of hidden layer nodes, the accuracy increases first, suddenly decreases at the position of node number 7, continues to increase, suddenly increases to number 8, and has a small up and down oscillation before number 11, with no more significant changes. Therefore, the model is accurate enough with 11 hidden layer nodes. On the other hand, the lower the number of nodes, the more efficient the prediction model is in terms of computational cost. Considering the above two influencing factors, the prediction models of sampler penetration depth with a number of nodes ranging from 11 to 15 are all acceptable. The model calculation accuracy does not differ much, and the efficiency is good. We chose 11 as the number of nodes in the hidden layer in this study, and other numbers of nodes are also acceptable.  
Finally, a gravity sampler penetration depth machine learning model (Figure 3) was built with six parameters consisting of weight of sampler, internal diameter, external diameter, cutter diameter, velocity, and sediment type as the input layer; 11 nodes as the hidden layer; and penetration depth as the output layer. A final gravity sampling penetration depth prediction model can be made by using this structured neural network to train and test the gravity sampling data.  
Figure 3: Illustration of the penetration depth prediction neural network. The green nodes, brown nodes, red nodes represent input node, hidden nodes and output nodes, respectively.  
Figure 2: Comparison of the accuracy of different hidden-layer node models. The purple area is the relatively appropriate number of hidden layer nodes. (**a**) Variation of \(EVS\) with the increase in hidden nodes; (**b**) variation of \(MAE\) with the increase hidden nodes; (**c**) variation of \(MSE\) with the increase in hidden nodes; (**d**) variation of \(R^{2}\) with the increase in hidden nodes.