Skip to main content
. 2021 Aug 22;23(8):1090. doi: 10.3390/e23081090
Algorithm 1: (Few-shot AI corrector [83]: 1NN version. Training). Input: sets X, Y; the number of clusters, k; threshold, θ (or thresholds θ1,,θk).
  1. Determining the centroid x¯ of the X. Generate two sets, Xc, the centralised set X, and Y, the set obtained from Y by subtracting x¯ from each of its elements.

  2. Construct Principal Components for the centralised set Xc.

  3. Using Kaiser, broken stick, conditioning rule, or otherwise, select mn Principal Components, h1,,hm, corresponding to the first largest eivenvalues λ1λm>0 of the covariance matrix of the set Xc, and project the centralized set Xc as well as Y onto these vectors. The operation returns sets Xr and Yr, respectively:
    Xr={x|x=Hz,zXc}Yr={y|y=Hz,zY},H=h1ThmT.
  4. Construct matrix W
    W=diag1λ1,,1λm
    corresponding to the whitening transformation for the set Xr. Apply the whitening transformation to sets Xr and Yr. This returns sets Xw and Yw:
    Xw={x|x=Wz,zXr}Yw={y|y=Wz,zYr}.
  5. Cluster the set Yw into k clusters Yw,1,,Yw,k (using e.g. the k-means algorithm or otherwise). Let y¯1,,y¯k be their corresponding centroids.

  6. For each pair (Xw,Yw,i), i=1,,k, construct (normalised) Fisher discriminants w1,,wk:
    wi=(Cov(Xw)+Cov(Yw,i))1y¯i(Cov(Xw)+Cov(Yw,i))1y¯i.

    An element z is associated with the set Yw,i if (wi,z)>θ and with the set Xw if (wi,z)θ.

    If multiple thresholds are given then an element z is associated with the set Yw,i if (wi,z)>θi and with the set Xw if (wi,z)θi.

Output: vectors wi, x¯, i=1,,k, matrices H and W.