Skip to main content
. 2021 Feb 25;21(5):1595. doi: 10.3390/s21051595
Algorithm 1 Training the proposed adaptive weighted multitask network.
Require: Training ECG signals XtrainECG, validation ECG signals XvalECG
Ensure: Multitask neural network model MODEL to BP estimation
  • 1:

    Initialize task loss’ weight θi← 1/3

  • 2:

    Initialize multitask network weights including sharing weights Wshare and task-specific weights Wi

  • 3:

    Initialize maximum iterated epochs N

  • 4:

    fork=0Ndo

  • 5:

        # Training phase

  • 6:

        Load XtrainECG

  • 7:

        Update parameters of MODEL with loss function of Equation (4)

  • 8:

        # Validation phase

  • 9:

        Load XvalECG, dividing into M batches

  • 10:

        Load trained MODEL and validate

  • 11:

        Compute mean value Lmeani(k) and standard deviation Lstdi(k) of losses of M batches

  • 12:

        if k>0 then

  • 13:

            Compute trend of mean value of losses Tmeani based on Equation (8)

  • 14:

            Compute trend of standard deviation of losses Tstdi based on Equation (9)

  • 15:

            Compute task-specific weight θi based on Equation (10)

  • 16:

        end if

  • 17:

    end for