Skip to main content
. 2024 Mar 26;11(4):314. doi: 10.3390/bioengineering11040314
Algorithm 2. RanAdam Hyper-parameter Tuning
  • Step 1.

    Start Algorithm

  • Step 2.

    Initialise iteration counter, t = 0

  • Step 3.

    Initialise and assign values to hyper-parameters β1, β2, , Lr, wt, wt+1, vt,st

  • Step 4.

    Initialise parameters (weights) for the chosen classifier

  • Step 5.

    Define the loss function to be minimised

  • Step 6.

    For each iteration t:

  • Step 7.

    Compute the gradient of the loss function with respect to the hyper-parameters, Lrwt

  • Step 8.

    Update the exponential moving averages of the gradient and its square, vt and st using Equations (30) and (31)

  • Step 9.

    Compute bias-corrected estimates of the averages, Vt^ and St^ using Equations (28) and (29)

  • Step 10.

    Update the parameters (weights) or the chosen classifier

  • Step 11.

    Calculate ER for the current equation

  • Step 12.

    If tr=1, compute the gradient of the loss function with respect to the hyper-parameter win

  • Step 13.

    Else if >1, compute the gradient of the loss function with respect to the hyper-parameter wtr.

  • Step 14.

    Initialise random numbers for Rand1, Rand2, Rand3, Rand4 and specify bandwidth

  • Step 15.

    if rand 1 < solution considering rate

  • Step 16.

    wt+1=wt

  • Step 17.

    End if

  • Step 18.

    if rand 2 < solution adjusting rate

  • Step 19.

    wt+1=wt * bandwidth * rand 3

  • Step 20.

    End if

  • Step 21.

    If wt+1 < Lower bound (LB)

  • Step 22.

    wt+1=LB

  • Step 23.

    End if

  • Step 24.

    if wt+1 > Upper bound (UB)

  • Step 25.

    wt+1 = UB

  • Step 26.

    End if

  • Step 27.

    if wt+1 < UB

  • Step 28.

    wt+1 = LB + rand4 * bandwidth

  • Step 29.

    End if

  • Step 30.

    If (ER = minimum ER)

  • Step 31.

    Optimum weight, wopt = wt+1

  • Step 32.

    Else

  • Step 33.

    Go to Step 14

  • Step 34.

    If t = ConvCrit

  • Step 35.

    Go to Step 38

  • Step 36.

    Else

  • Step 37.

    Go to Step 7

  • Step 38.

    End Algorithm