/** * Computes variance for subsets. * * @param s * @param sS * @param sumOfWeights * @return the variance */ protected static double variance(double[] s, double[] sS, double[] sumOfWeights) { double var = 0; for (int i = 0; i < s.length; i++) { if (sumOfWeights[i] > 0) { var += singleVariance(s[i], sS[i], sumOfWeights[i]); } } return var; }
/** * Computes variance for subsets. * * @param s * @param sS * @param sumOfWeights * @return the variance */ protected static double variance(double[] s, double[] sS, double[] sumOfWeights) { double var = 0; for (int i = 0; i < s.length; i++) { if (sumOfWeights[i] > 0) { var += singleVariance(s[i], sS[i], sumOfWeights[i]); } } return var; }
trainVariance = RandomTree .singleVariance(classProbs[0], totalSumSquared, totalWeight) / totalWeight; classProbs[0] /= totalWeight;
trainVariance = RandomTree .singleVariance(classProbs[0], totalSumSquared, totalWeight) / totalWeight; classProbs[0] /= totalWeight;
if (data.classAttribute().isNumeric()) { trainVariance = RandomTree.singleVariance(classProbs[0], totalSumSquared, totalWeight) / totalWeight; classProbs[0] /= totalWeight;
if (data.classAttribute().isNumeric()) { trainVariance = RandomTree.singleVariance(classProbs[0], totalSumSquared, totalWeight) / totalWeight; classProbs[0] /= totalWeight;
RandomTree.singleVariance(totalSum, totalSumSquared, totalSumOfWeights);
RandomTree.singleVariance(totalSum, totalSumSquared, totalSumOfWeights);
RandomTree.singleVariance(totalSum, totalSumSquared, totalSumOfWeights);
RandomTree.singleVariance(totalSum, totalSumSquared, totalSumOfWeights);
singleVariance(totalSum, totalSumSquared, totalSumOfWeights); double var = variance(sums, sumSquared, sumOfWeights); double gain = priorVar - var;
singleVariance(totalSum, totalSumSquared, totalSumOfWeights); double var = variance(sums, sumSquared, sumOfWeights); double gain = priorVar - var;