k-Nearest Neighbors - 5.2 English - 68552

AOCL API Guide (68552)

Document ID
68552
Release Date
2025-12-29
Version
5.2 English

The following options are supported.

Table 4.10 Table of Options for k-Nearest Neighbors.#

Option name

Type

Default

Description

Constraints

weights

string

\(s=\) uniform

Weight function used to compute the k-nearest neighbors.

\(s=\) distance, or uniform.

metric

string

\(s=\) euclidean

Metric used to compute the pairwise distance matrix.

\(s=\) cityblock, cosine, euclidean, euclidean_gemm, l1, l2, manhattan, minkowski, sqeuclidean, or sqeuclidean_gemm.

algorithm

string

\(s=\) auto

Algorithm used to compute the k-nearest neighbors.

\(s=\) auto, ball tree, brute, or kd tree.

radius

real

\(r=1\)

Maximum distance for the radius neighbors computation.

\(0 \le r\)

minkowski parameter

real

\(r=2\)

Minkowski parameter for metric used for the computation of k-nearest neighbors.

\(0 < r\)

leaf size

integer

\(i=30\)

Leaf size for k-d tree.

\(1 \le i\)

number of neighbors

integer

\(i=5\)

Number of neighbors considered for k-nearest neighbors.

\(1 \le i\)

check data

string

\(s=\) no

Check input data for NaNs prior to performing computation.

\(s=\) no, or yes.

storage order

string

\(s=\) column-major

Whether data is supplied and returned in row- or column-major order.

\(s=\) c, column-major, f, fortran, or row-major.