Skip to main content
. 2024 May 31;17(11):2657. doi: 10.3390/ma17112657
Algorithm 1 Training steps for the MLP model
Input: Training set D={(x(n),y(n))}n=1N, validation set V, learning rate αϕ, number of network layers L, number of neurons Ml, activation function for each layer fl, where 1≤l≤L.
1. Randomly initialize the weight matrix W and bias matrix b for each layer;
2. Randomly disrupt the samples in the training dataset D;
3. For n = 1…N do;
4. Samples (x(n),y(n)) are selected from the training set D 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 W and bias matrix b 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.