for (Map<String, Object> row : data) {
        if ((double) row.get(feature) <= threshold) {
          leftLabels.add((String) row.get("label"));
        } else {
          rightLabels.add((String) row.get("label"));
        }
      }
// Hitung information gain
      double totalEntropy = calculateEntropy(leftLabels) * leftLabels.size() / data.size() +
          calculateEntropy(rightLabels) * rightLabels.size() / data.size();
      double gain = calculateEntropy(labelsFromData(data)) - totalEntropy;
Beri Komentar
Belum ada komentar. Jadilah yang pertama untuk memberikan komentar!