Skip to main content
. 2023 Feb 20;23(4):2333. doi: 10.3390/s23042333
Algorithm 2 Fold generation of DOB-SCV (based on Ref. [20])
Require: k             // number of folds
Require: C={C1,C2,…,Cn}     // classes
Ensure: F1,F2,…,Fk                           // generated folds
F1←∅,F2←∅,…,Fk←∅
for i:=1 to n do
      while count(Ci)>0 do
            x1← randomly select sample from Ci
            F1←F1∪{x1}
            Ci←Ci \ {x1}
            for j:=2 to k do
                 x2← select the nearest neighbour of x1 from Ci
                 Fj←Fj∪{x2}
                 Ci←Ci \ {x2}
                 if count(Ci)=0 then
                      j←k                         // end for j
                 end if
            end for
      end while
end for