Back to Adaptive Vision Library website
You are here: Start » Function Reference » Nearest Neighbors » KNN_Classify
KNN_Classify
Classify data using the KNN classifier.
Syntax
C++
C#
void avl::KNN_Classify ( const avl::KNNModel& inKNNModel, const atl::Array<atl::real>& 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<real>& | Vector of features | ||
![]() |
inK | const int | 1 - +![]() |
Numbers of neighbors | |
![]() |
inDistanceType | const Metric::Type | Geometry distance type used to calculate neighbors | ||
![]() |
outClass | int& |
Errors
| Error type | Description |
|---|---|
| DomainError | Using not trained classifier in KNN_Classify. |
| DomainError | The inFeature has different dimensions count than KNNModel in KNN_Classify. |
| DomainError | The inK is bigger than data samples count in KNN_Classify. |



