Skip to main content
. 2024 Oct 14;10:e2408. doi: 10.7717/peerj-cs.2408

Algorithm 1. KG-GAN model training for data imputation.

Input: Original complete traffic dataset Xt(m×n); road adjacency triplet R; attribute triplet ATT; attribute co-occurrence triplet Relations; loss hyperparameters α; masking matrix M; indicator matrix H; the number of epochs N and the initialized parameters: generator θGT, generator θGS, and discriminator θD
  1: Construct a KG = {R, ATT, Relations} triplet.
  2: By maximizing the P(R,ATT|XE) obtain the knowledge representation matrix XE.
  3: Integrating Xt and XE : Xt=EM- Cell(Xt,XE)
  4: for epoch=1,2,…,N
  5:    (1) Discriminator optimization:
  6:       Obtain discriminator loss LD via Eqs. (1013)
  7:       Back-propagate LD to update θD
  8:    (2) Generator optimization:
  9:       Obtain the output of GTX^ via Eqs. (10), (11)
 10:        LR1=1ni=1n||(XtX^)M||22
 11:        LGTD(X^,H)+αLR1
 12:       Obtain the output of GSX¯ via Eq. (12)
 13:        LR2=1ni=1n||(XtX¯)M||22
 14:        LGSD(X¯,H)+αLR2
 15:       Back _propagate LGT, LGS to update θGT, θGS
 16: endfor
 17: Impute the missing values:
 18: Obtain imputed data Ximputed via Eqs. (1012)
Output: Trained parameters θGT, θGS, and θD; imputed data Ximputed