protected boolean getStats(Instances instances, double[] stats) {
		stats[0] = stats[1] = stats[2] = 0;
		if (instances.size() == 0) {
			return true;
		}
		double firstTarget = instances.get(0).getTarget();
		boolean stdIs0 = true;
		for (Instance instance : instances) {
			double weight = instance.getWeight();
			double target = instance.getTarget();
			stats[0] += weight;
			stats[1] += weight * target;
			if (stdIs0 && target != firstTarget) {
				stdIs0 = false;
			}
		}
		stats[2] = stats[1] / stats[0];
		if (Double.isNaN(stats[2])) {
			stats[2] = 0;
		}
		return stdIs0;
	}