docs: protected double computeCandidateWeight(Classifier candidate, Instances chunk, int numFolds) {
          double candidateWeight = 0.0;
          Random random = new Random(1);
          Instances randData = new Instances(chunk);
          randData.randomize(random);
          if (randData.classAttribute().isNominal()) {
              randData.stratify(numFolds);
          }
  
          for (int n = 0; n < numFolds; n++) {
              Instances train = randData.trainCV(numFolds, n, random);
              Instances test = randData.testCV(numFolds, n);
  
              Classifier learner = candidate.copy();
  
              for (int num = 0; num < train.numInstances(); num++) {
                  learner.trainOnInstance(train.instance(num));
              }
  
              candidateWeight += computeWeight(learner, test);
          }
  
          double resultWeight = candidateWeight / numFolds;
  
          if (Double.isInfinite(resultWeight)) {
              return Double.MAX_VALUE;
          } else {
              return resultWeight;
          }
      }