double meanNoMissing;
double totalSum = 0, totalSumOfWeights = 0;
  private double findSplitNumericNumeric(int index) throws Exception {    double bestVal = Double.MAX_VALUE, currVal, currCutPoint;    int numMissing = 0;    double[] sumsSquares = new double[3], sumOfWeights = new double[3];    double[][] bestDist = new double[3][1];    double meanNoMissing;    // Compute counts for all the values    for (int i = 0; i < theInstances.numInstances(); i++) {      Instance inst = theInstances.instance(i);      if (!inst.isMissing(index)) {	m_Distribution[1][0] += inst.classValue() * inst.weight();	sumsSquares[1] += inst.classValue() * inst.classValue() 	  * inst.weight();	sumOfWeights[1] += inst.weight();      } else {	m_Distribution[2][0] += inst.classValue() * inst.weight();	sumsSquares[2] += inst.classValue() * inst.classValue() 	  * inst.weight();	sumOfWeights[2] += inst.weight();	numMissing++;      }    }    meanNoMissing = m_Distribution[1][0] / sumOfWeights[1];    // Sort instances    theInstances.sort(index);        // Make split counts for each possible split and evaluate    for (int i = 0; i < theInstances.numInstances() - (numMissing + 1); i++) {      Instance inst = theInstances.instance(i);      Instance instPlusOne = theInstances.instance(i + 1);      m_Distribution[0][0] += inst.classValue() * inst.weight();      sumsSquares[0] += inst.classValue() * inst.classValue() * inst.weight();      sumOfWeights[0] += inst.weight();      m_Distribution[1][0] -= inst.classValue() * inst.weight();      sumsSquares[1] -= inst.classValue() * inst.classValue() * inst.weight();      sumOfWeights[1] -= inst.weight();      if (Utils.sm(inst.value(index), instPlusOne.value(index))) {	currCutPoint = (inst.value(index) + instPlusOne.value(index)) / 2.0;	currVal = variance(m_Distribution, sumsSquares, sumOfWeights);	if (Utils.sm(currVal, bestVal)) {	  m_SplitPoint = currCutPoint;	  bestVal = currVal;	  for (int j = 0; j < 3; j++) {	    bestDist[j][0] = m_Distribution[j][0] / sumOfWeights[j];	  }	}      }    }    // No missing values in training data        if (numMissing == 0) {      bestDist[2][0] = meanNoMissing;    }    m_Distribution = bestDist;    return bestVal;  }