/** * Learn the 1-NN classifier from data of type double[]. * @param x the training samples. * @param y training labels in [0, c), where c is the number of classes. */ public static KNN<double[]> learn(double[][] x, int[] y) { return learn(x, y, 1); }
public static Knn learn(int k, IntConvertibleColumn labels, NumericColumn... predictors) { KNN<double[]> classifierModel = KNN.learn(DoubleArrays.to2dArray(predictors), labels.asIntArray(), k); return new Knn(classifierModel); }