knnFit

Purpose

Creates a K-D tree model from training data for efficient KNN predictions.

Format

mdl = knnFit(y, X, k);

Inputs

X
NxP matrix, the training data.
y
Nx1 vector or string array, the training target labels.
k
Scalar, the number of neighbors.

Output

mdl
knModel structure with the following members:
  mdl.opaqueModel Column vector, containing the K-D tree in opaque form.
  mdl.classIndices Px1 matrix, where P is the number of classes in the target vector y.
  mdl.classNames Px1 string array, where P is the number of classes in the target vector y, containing the class names if the target vector was a string array.
  mdl.k Scalar, the number of neighbors to search.

See also

knnClassify

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

REQUEST A FREE QUOTE

Thank you for your interest in the GAUSS family of products.

© Aptech Systems, Inc. All rights reserved.

Privacy Policy | Sitemap