knn.train(features, outcome);
DoubleVector prediction = knn.predict(new SingleEntryDoubleVector(5));
assertArrayEquals(new double[] { 1d, 0, 0, 0, 1d }, prediction.toArray());
prediction = knn.predictProbability(new SingleEntryDoubleVector(5));
assertArrayEquals(new double[] { 0.5, 0, 0, 0, 0.5 }, prediction.toArray());
}
void assertArrayEquals(double[] real, double[] actual) {
assertEquals(real.length, actual.length);
for (int i = 0; i < real.length; i++) {