Skip to main content
. 2022 Aug 15;22(16):6104. doi: 10.3390/s22166104
Algorithm 3 Trend Attention Mechanism.
  • Input:

  •      physiological time series S

  • Output:

  •      trend level attention weights

  • 1:

      nsch=getNor(sch); // normalize each channel of the time series

  • 2:

      mskch=getMean(nskch); // calculate the mean of the k-th segment nsk

  • 3:

      dskch=getDiff(mskch,mskch); // calculate the difference between all the segments

  • 4:

      trcch=getMax(dskch); // obtain the maximum value of dskch

  • 5:

      AttO = getSim(X, trcch); // calculate the similarity between X and trcch

  • 6:

      AttT = getFull(AttO); // convert AttO into AttT through the fully connected layer

  • 7:

      β = softmax(AttT); // calculate the trend level attention weights