@Override
	public double[] predictProbabilities(Instance instance) {
		if (trees.length == 1) {
			double[] prob = new double[2];
			double pred = regress(instance);
			prob[1] = MathUtils.sigmoid(pred);
			prob[0] = 1 - prob[1];
			return prob;
		} else {
			double[] prob = new double[trees.length];
			double[] pred = new double[trees.length];
			for (int i = 0; i < trees.length; i++) {
				pred[i] = trees[i].regress(instance);
			}
			double max = StatUtils.max(pred);
			double sum = 0;
			for (int i = 0; i < prob.length; i++) {
				prob[i] = Math.exp(pred[i] - max);
				sum += prob[i];
			}
			VectorUtils.divide(prob, sum);
			return prob;
		}
	}