Skip to main content
. 2021 Jul 7;21(14):4666. doi: 10.3390/s21144666
Algorithm 1. Learning algorithm of EGCF.
  • Input:

    The observed interactions between users and items, i.e., O+;

  • Output:

    The embeddings of users and items in EGCF;

  • 1:

    G={V,E}←GraphConstruct (O+);

  • 2:

    for epoch in 1, …, s do

  • 3:

        for minibatch M∈X do

  • 4:

            for (u,i) in OM+ do

  • 5:

                 j←RandomSample(u);

  • 6:

                 eu,ei,ej←EmbeddingLayer(u,i,j);

  • 7:

                 au,ai,aj←SGCN(Nu,Ni,Nj) based on Equation (1);

  • 8:

                 zu,zi,zj←Combination([eu,au],[ei,ai],[ej,aj]) based on Equation (2);

  • 9:

                 y^ui,y^uj=Prediction(zu,zi,zj) based on Equation (3);

  • 10:

               Ls=BPR(y^ui,y^uj) based on Equation (4);

  • 11:

               Lci=InfoNCE(ei,au,ak), k∈UM\u based on Equation (5);

  • 12:

               Lcu=InfoNCE(eu,ai,ak), k∈IM\i based on Equation (6);

  • 13:

               Lc=Lci+Lcu based on Equation (7);

  • 14:

            end for

  • 15:

            Optimize joint learning loss: L=Ls+αLc;

  • 16:

            use back-propagation to optimize the parameters;

  • 17:

        end for

  • 18:

    end for

  • 19:

    return User and item embeddings E.