Creates a K-D tree model from training data for efficient KNN predictions.
mdl = knnFit(y, X, k);
- NxP matrix, the training data.
- Nx1 vector or string array, the training target labels.
- Scalar, the number of neighbors.
- knModel structure with the following members:
||Column vector, containing the K-D tree in opaque form.|
||Px1 matrix, where P is the number of classes in the target vector
||Px1 string array, where P is the number of classes in the target vector
||Scalar, the number of neighbors to search.|