ILNumerics Ultimate VS

MachineLearningknn Method

ILNumerics Ultimate VS Documentation
ILNumerics - Technical Application Development
Searches for k nearest neighbors for every sample in Samples samples.

[ILNumerics Machine Learning Toolbox]

Namespace:  ILNumerics.Toolboxes
Assembly:  ILNumerics.Toolboxes.MachineLearning (in ILNumerics.Toolboxes.MachineLearning.dll) Version: 5.5.0.0 (5.5.7503.3146)
Syntax

public static RetArray<long> knn(
	InArray<double> Samples,
	InArray<double> Neighbors,
	int k = 10,
	DistanceMetrics metric = DistanceMetrics.Euclidian_L2,
	double minkowski_parameter = 2,
	bool unstable_error = true
)

Parameters

Samples
Type: ILNumericsInArrayDouble
Samples matrix, samples in columns, the number of rows (dimensionality) must match the number of rows in Neighbors.
Neighbors
Type: ILNumericsInArrayDouble
Matrix of training samples/ neighbors, this will be searched for matching points, rows: dimensionality, columns: number of points.
k (Optional)
Type: SystemInt32
[Optional] Number of neighbors to return, k must lay in range: 0 <= k < neighbors.D[1]; default: 1.
metric (Optional)
Type: ILNumerics.ToolboxesDistanceMetrics
[Optional] Distance metric, one out of the [!:ILNumerics.Toolboxes.MachineLearning.DistanceMetrics] enumeration. Supported are: Euclidian_L2,Manhattan_L1, Minkowski, Cosine, Pearsons and Hamming distances; default: 'Euclidian_L2'.
minkowski_parameter (Optional)
Type: SystemDouble
[Optional] Exponent for minkowski distance; default: 2.
unstable_error (Optional)
Type: SystemBoolean
[Optional] For cosine and pearson distances: if some samples lead to numerical instabilities, an exception is generated; default: true.

Return Value

Type: RetArrayInt64
Matrix of nearest neighbors, size: k x samples.D[1]; indices of points in Neighbors matrix.
Remarks

[ILNumerics Machine Learning Toolbox]

See Also

Reference