You are here: Start » Function Reference » Support Vector Machines » SVM_ClassifySingle

# SVM_ClassifySingle

Header: | AVL.h |
---|---|

Namespace: | avl |

Classifies input features based on a trained model

### Syntax

void avl::SVM_ClassifySingle ( const avl::SvmModel& inSvmModel, const atl::Array<float>& inVector, int& outPrediction, atl::Optional<atl::Array< int >& > outModelClasses = atl::NIL, atl::Optional<atl::Array<float>& > outClassProbabilities = atl::NIL )

### Parameters

Name | Type | Default | Description | |
---|---|---|---|---|

inSvmModel | const SvmModel& | Input trained model | ||

inVector | const Array<float>& | Data vector of unknown class | ||

outPrediction | int& | Predicted classes | ||

outModelClasses | Optional<Array< int >& > | NIL | All known model classes in order | |

outClassProbabilities | Optional<Array<float>& > | NIL | For each data vector the probability of belonging to each class |

### Optional Outputs

The computation of following outputs can be switched off by passing value `atl::NIL`

to these parameters: outModelClasses, outClassProbabilities.

Read more about Optional Outputs.

### Description

The operation predicts classes for the given data points. It takes a data vector (inVector) as
an argument. The vector has to be of the same size as vectors used for training the model.
The operation outputs predicted class (outPrediction) for the data vector.

outModelClasses are all class labels encountered during training.

outClassProbabilities provides, for the input vector, estimated probability belonging to each class.
Precisely, the value under index **i** denotes probability of given vector belonging to the class outModelClasses**[i]**.

### Errors

List of possible exceptions:

Error type | Description |
---|---|

DomainError |
Incorrect vector size in SVM_ClassifySingle |

DomainError |
Incorrect, uninitialized or not trained SvmModel in SVM_ClassifySingle. |

### See Also

- SVM_ClassifyMultiple – Classifies input points based on trained model

- SVM_Init – Initializes SVM model

- SVM_Train – Trains SVM model