Nearest centroid classifier: Difference between revisions

Content deleted Content added
Created page with 'In machine learning, a '''nearest centroid''' or '''nearest prototype classifier''' is a classification model that assigns to ...'
 
Algorithm: correction: class, not set
Line 29:
 
== Algorithm ==
* Training procedure: given labeled training samples <math>\textstyle\{(\vec{x}_1, y_1), \dots, (\vec{x}_n, y_n)\}</math> with class labels <math>y_i \in \mathbf{Y}</math>, compute the per-class centroids <math>\textstyle\vec{\mu_l} = \frac{1}{|C_l|}\sum_{i \in C_l} \vec{x}_i</math> where <math>C_l</math> is the set of indices of samples belonging to setclass <math>l \in \mathbf{Y}</math>.
* Prediction function: the class assigned to an observation <math>\vec{x}</math> is <math>\hat{y} = {\arg\min}_{l \in \mathbf{Y}} \|\vec{\mu}_l - \vec{x}\|</math>