Skip to main content
. 2023 Jan 23;23(3):1307. doi: 10.3390/s23031307
Algorithm 1 Overall procedure of SSGAE.
Input: Graph Gtraink={Ak,Xk}k=1K, Gtestk={Ak,Xk}k=1K; Learnable parameter Θ; Hyper-parameter β; Number L of the hidden layers in SSGAE; Number T of the training epochs.
Output: Anomaly score sik for each node vik via function f(·).
  • 1:

    ▹ Training Stage.

  • 2:

    Randomly initialize Θ and the trainable parameters in MLPEnc, MLPStrDec and MLPAttDec;

  • 3:

    fort=1,2,,Tdo;

  • 4:

    for k=1,2,,K do

  • 5:

      for l=1,2,,L do

  • 6:

       Calculate H(l) via Equation (3);

  • 7:

      end for

  • 8:

      Zk=H(L);

  • 9:

      for l=1,2,,L do

  • 10:

       Calculate H^(l) via Equation (6);

  • 11:

      end for

  • 12:

      X^k=H^(L);

  • 13:

      Calculate A^k via Equation (4);

  • 14:

      Update Θ and the trainable parameters in MLPEnc, MLPStrDec, and MLPAttDec via Equation (8) with the backpropagation algorithm.

  • 15:

    end for

  • 16:

    end for

  • 17:

    ▹ Test Stage.

  • 18:

    fork=1,2,,Kdo

  • 19:

    for l=1,2,,L do

  • 20:

      Calculate H(l) via Equation (3);

  • 21:

    end for

  • 22:

    Zk=H(L);

  • 23:

    for l=1,2,,L do

  • 24:

      Calculate H^(l) via Equation (6);

  • 25:

    end for

  • 26:

    X^k=H^(L);

  • 27:

     Calculate A^k via Equation (4);

  • 28:

     Calculate anomaly score sik of each node vik in Gtestk via Equation (9).

  • 29:

    end for