Skip to main content
. 2022 Jun 30;24(7):910. doi: 10.3390/e24070910
Algorithm 1 PGraphDD-QM: concept drift detection using quality metrics
  • Require: 

    Event stream: S, LSTM model: μ, Threshold: ϕ

  • 1:

    fScoreLog[], DriftLog[]

  • 2:

        {read event stream, split windows, prepare data, train LSTM model and make predictions}

  • 3:

    efetch(eventStream)

  • 4:

    wWinSize {the window size}

  • 5:

    partssplitLog(e,w)

  • 6:

    for alli in range(0, parts) do

  • 7:

       ji+1

  • 8:

       if i=parts1 then

  • 9:

         j0

  • 10:

        Rpart(i), Dpart(j)

  • 11:

      end if

  • 12:

      while w0 do

  • 13:

        prepare(R,D)

  • 14:

        μ(μ,R)    {train an LSTM model on the reference window}

  • 15:

           {Apply the trained model to both reference and detection windows}

  • 16:

        Rpredpredict(μ,R)

  • 17:

        Dpredpredict(μ,D)

  • 18:

            {build next event prediction probability matrices, construct graphs}

  • 19:

        PijRgenerate(Pred_Prob_Mat,Rpred)

  • 20:

        PijDgenerate(Pred_Prob_Mat,Dpred)

  • 21:

        GRdrawGraph(i,o,N,E,PijR,Rpred)

  • 22:

        GDdrawGraph(i,o,N,E,PijD,Dpred)

  • 23:

            {calculate the quality metrics}

  • 24:

        pperformance()

  • 25:

        fitnessp.fitness()

  • 26:

        precisionp.precision()

  • 27:

        fScorep.fScore(fitness,precision)

  • 28:

        if fScoreϕ then

  • 29:

           print(driftfoundinwindow+str(j))

  • 30:

           Report(i,j,fScore)

  • 31:

        end if

  • 32:

      end while

  • 33:

    end for