Skip to main content
. 2022 Aug 28;22(17):6472. doi: 10.3390/s22176472
Algorithm 1: Hyperparametric optimization algorithm of PSO-CNN.
Input: MAX_Iteration, boundary of the hyperparametric space θ, number of particles n
Output: Optimal super parameters and maximum fault feature recognition accuracy
1 Randomly generate n particles to form the initial population:
θj={cnnL,ci,k,d,r},  j=1,2,,n
Set an optimal super parameter (θbest) and maximum accuracy (accuracy_best)
2 for I = 1:MAX_Iteration
3   for j = 1: n
4    train CNN model and output accuracy
5    accuracy  execute (CNN model)
6    if accuracy > accuracy_max
7      θbestθj
8      accuracy_best  accuracy
9 Update the speed and position of each particle