Nearest centroid classifier: Difference between revisions

Content deleted Content added
m references: +url, publisher, title
Line 32:
 
== 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_underset{i \in C_l}{\sum} \vec{x}_i</math> where <math>C_l</math> is the set of indices of samples belonging to class <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>