Skip to main content
. 2020 Feb 19;22(2):236. doi: 10.3390/e22020236
Algorithm 1 Recursive entropy estimator
  • 1:

    functioncopulaH({xki}, D, N, level=0)

  • 2:

    H0

  • 3:

    for k = 1 to D do

  • 4:

      uk rank(xk)/N                     ▹ Calculate rank (by sorting)

  • 5:

      HH+ H1D({uki}, N, level)                ▹ entropy of marginal k

  • 6:

    end for

  • 7:

      

  • 8:

    if D=1 or N<= min #samples then

  • 9:

      return H

  • 10:

    end if

  • 11:

      

  • 12:

                            ▹A is the matrix of pairwise independence

  • 13:

    Aij= true if xi and xj are statistically independent

  • 14:

    nblocks # of blocks in A.

  • 15:

    if nblocks>1 then                         ▹ Split dimensions

  • 16:

      for j=1 to nblocks do

  • 17:

       v elements in block j

  • 18:

       HH+ copulaH({uki}kvi=1N,dim(v),N,level)

  • 19:

      end for

  • 20:

      return H

  • 21:

    else                             ▹ No independent blocks

  • 22:

      k choose a dim for splitting

  • 23:

      L={i|uki1/2}

  • 24:

      {vji}={2uji|iL,j=1D}

  • 25:

      HH+ copulaH({vji},D,N/2,level+1) /2

  • 26:

      

  • 27:

      R={i|uki>1/2}

  • 28:

      {wji}={2uji1|iR,j=1D}

  • 29:

      HH+ copulaH({wji},D,N/2,level+1) /2

  • 30:

    end if

  • 31:

    end function