Back to Adaptive 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
inKNNModel const KNNModel& Trained KNN model
inFeature const Array<float>& Vector of features
inK const int 1 - + Numbers of neighbors
inDistanceType const Metric::Type Geometry distance type used to calculate neighbors
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.