Skip to main content
. 2023 Nov 13;23(22):9146. doi: 10.3390/s23229146
Algorithm 1. Node Random Pruning Algorithm.
Given the parameters to be deleted, W=[w1,…,wL],b=[b1,…,bL],β=[β1,…,βL],
where L is the number of node; the initial accuracy of the network, α; test data X,Y;
setting an acceptable accuracy ϵ=α−0.01; and the maximum number of nodes that
can be deleted, Nmax=⌊0.2∗L⌋.
1. Initialize states←zeros(Nmax+1),states[0]←α,diclist←[]
2. For n=1 To Nmax+1 Do
3.  num=CLn,accuracy_and_indices←{},accuracylist←[]
4.   If  num>10000
5.      num=10000
6.   For  k=1  To  num  Do
7.     Randomly choice indices of n nodes from original nodes.
8.     Remove the corresponding nodes from the original list
      based on the indices of the nodes to be deleted.
9.     W*= delete (W,indices)
10.     b*= delete (b,indices)
11.     β*= delete (β,indices)
12.     Calculate the accuracy of the model after removing the nodes.
13.     accuracy= accuracy_score (W*,b*,β*,X,Y)
14.     If  accuracy≥ϵ
15.      accuracy_and_indices← append {accuracy:indices}
16.      accuracy_list← append [accuracy]
17.  End For (corresponds to Step 4)
18.  diclist← append [accuracy_and_indices]
19.  states[n]= max (state[n−1], max (accuracy_list))
20. End For (corresponds to Step 2)
21. Return states,diclist.