Skip to main content
. 2020 Aug 6;20(16):4392. doi: 10.3390/s20164392
Algorithm 1 Weight learning.
1: functionWeight Learning(X,Y,α,NumEpochs)
2:    w[1,1,,1]
3:    minLoss
4:    w^w
5:    for epoch(1,NumEpochs) do
6:        Y^[]
7:        forxiX do
8:           SRemove(xi,X) ▹ Remove xi from training set
9:           yi^EVREG(xi,S,w) ▹ Predict example ei with training set S
10:           Insert(yi^,Y^) ▹ Insert yi^ in Y^
11:        end for
12:        lossL(Y,Y^) ▹ Compute loss
13:        gradientCalculateGradient(Y,Y^) ▹ Compute gradient
14:        ww+α*gradient ▹ Update weights vector
15:        if minLoss>lossthen ▹ Save best weight vector
16:           minLossloss
17:           w^w
18:        end if
19:    end for
20:    return w^
21: end function