|
Algorithm 1 Training steps for the MLP model |
| Input: Training set , validation set , learning rate , number of network layers L, number of neurons , activation function for each layer , where . |
| 1. Randomly initialize the weight matrix and bias matrix for each layer; |
| 2. Randomly disrupt the samples in the training dataset ; |
| 3. For n = 1…N do; |
| 4. Samples are selected from the training set as inputs to the MLP network; |
| 5. Calculate the input and activation values for each layer; |
| 6. Calculate the error for each layer according to the backpropagation algorithm; |
| 7. Calculate the gradient for each layer of this sample; |
| 8. Update the weight matrix and bias matrix for each layer; |
| 9. End. |
| 10. Until a pre-determined number of iterations is reached, or the model has the required accuracy on the validation set, the model training is completed and the results are output. |