# Estimating Contact Force Chains Using Artificial Neural Network
## 2 Materials and Methods
### Artificial Neural Network  
Generally, there are three important types of neural networks, i.e., ANN, convolution neural networks (CNN) and recurrent neural networks (RNN), and each of them is tailored to certain types of tasks [40]. CNN models are commonly used to analyze visual imagery and frequently perform image classification work. RNN models are ubiquitous in sequence-to-sequence tasks such as speech recognition and machine translation, while ANN models are suitable for processing tabular data [40]. Therefore, the multilayer feedforward ANN model was adopted in the current study.  
A typical multilayer feedforward ANN model is designed and shown in Figure 5. It consists of nodes or neurons in three layers: an input layer, an output layer and a hidden layer. The links between nodes of adjacent layers have weights and biases associated with them. The purpose of learning is to assign correct parameters (i.e., weights and biases) for these edges. For the nodes in the input layer, their function is to pass the information to the hidden nodes through the edges with associated weights and biases and no computation is performed in any of the input nodes. The number of nodes used in the input layer is equal to the number of input features. For the nodes in the hidden layer, they perform computations by summing the weighted inputs and the bias and transferring the computational result through the _tan-sigmoid_ transfer function, \(f(x)=2/(1+\mathrm{e}^{-2x})-1\)[41].  
Figure 3: DEM simulation results. (**a–d**) Evolution of contact map during the shearing process; (**e–h**) the contact orientation distribution during the shearing process.  
The number of neurons in the hidden layer is 10. Generally, the number of hidden neurons has a significant influence on the power of the network. Increasing the number of hidden neurons increases the network performance, but needs more computational resources. The output layer has one node with a _linear_ transfer function, \(f(x)=x\). This node receives input from the hidden layer and performs similar computations as illustrated for the hidden nodes.  
Figure 4: Pre-processed data for machine learning. (**a**) The typical evolutions of the contact force and the coordination number; (**b**) the evolutions of other particle-scale features.  
Figure 5: Schematic of typical multilayer neural network model.  
We train the constructed ANN model by adjusting the weights and biases of these edges to optimize network performance. The training function is the _Levenberg-Marquardt_ algorithm, which can be thought of as a combination of _gradient descent_ and the _Gauss-Newton_ method [42]. The _Levenberg-Marquardt_ method behaves more like a _gradient-descent_ method when the parameters are far from the correct one, and behaves more like the _Gauss-Newton_ method when the parameters are close to the correct solution, by assigning a similar damping factor. The correlation coefficients between the outputs and targets are adopted to assess the performance of the trained or tested model.  
Four groups of simulated data are chosen to train the ANN model, which uses a set of examples to regress the parameters (e.g., weights and biases of the links between nodes of adjacent layers). The remaining one is used to test the fully trained model. In the training phase, both the five particle-scale features used as input and the contact force as label are provided. In the testing phase, we aim to predict the anisotropy of CFC by only providing these five particle-scale features. The performance of the model is evaluated by the correlation coefficient.