Back to Aurora Vision Library website

You are here: Start » Function Reference » Data Classification » Nearest Neighbors » KNN_Classify

KNN_Classify


Header: AVL.h
Namespace: avl
Module: FoundationPro

Classify data using the KNN classifier.

Syntax

C++
C#
 
void avl::KNN_Classify
(
	const avl::KNNModel& inKNNModel,
	const atl::Array<float>& inFeature,
	const int inK,
	const avl::Metric::Type inDistanceType,
	int& outClass
)

Parameters

Name Type Range Default Description
Input value inKNNModel const KNNModel& Trained KNN model
Input value inFeature const Array<float>& Vector of features
Input value inK const int 1 - + Numbers of neighbors
Input value inDistanceType const Metric::Type Geometry distance type used to calculate neighbors
Output value outClass int&

Errors

List of possible exceptions:

Error type Description
DomainError The inFeature has different dimensions count than KNNModel in KNN_Classify.
DomainError The inK is bigger than data samples count in KNN_Classify.
DomainError Using not trained classifier in KNN_Classify.