Skip to main content
. 2022 May 31;8:e953. doi: 10.7717/peerj-cs.953

Algorithm 2: Capsule Dual Graph CNN (C-DGCNN).

Input: FM, A, PPMI, yL, r, λ(t) and hidden convolution layers (H)
Output: Training model with best features.
Step 1: for t in range (0, Epoch number) do
Step 2:   ZA=ReLU(ConvLC) using Eq. (16)
Step 3:   ZP=ReLU(ConvGC) using Eq. (22)
Step 4:  Compute Loss using Eq. (23)
Step 5:  if convergence then break loops
Step 6:  end if
Step 7: end for
Step 8: Dynamic routing procedure (OCj|i,W′,r). // Where WRm×n is the matrix of wights.
Step 9: W¯W+rand(size(W))
Step 10: for all input capsules i and all output capsules j do
Step 11:   OCj|iWj¯ squash (OCj|i)) // Where Wj¯Rm.
Step 12: end for
Step 13: for all input capsules i and all output capsules j do
Step 14:   bij0
Step 15: end for
Step 16: for r iterations do
Step 17:  for all input capsules i do cisoftmax(bi)
Step 18:  for all output capsules j do sjici,jOCj|i
Step 19:  for all output capsule networks i do Oisquash(si) // Where squash(si)=si21+si2sisi.
Step 20:  for all input capsules i and output capsules j do
Step 21:   bijbij+OCj|iOj
Step 22: end for
Step 23: Return Oj
Step 24: end for