IFD:EAI SoS21/course material/Session 4: Programming the Classifier Part1: Difference between revisions

From Medien Wiki
Line 25: Line 25:
To be able to successfully classify a new point (a sound), the classifier actually only needs to know the <code>centroid of each class</code> and a way to <code>find the closest centroid</code> to our new point.
To be able to successfully classify a new point (a sound), the classifier actually only needs to know the <code>centroid of each class</code> and a way to <code>find the closest centroid</code> to our new point.


As a first step the classifier needs to calculate the centroids. For that it needs to know the
As a first step the classifier needs to calculate the centroids. For that it needs to know
* all our given points (=measurements of sounds)
* all our given points (=measurements of sounds)
* and to which class they belong (=classLabels)
* and to which class they belong (=classLabels)
We will feed this data into the classifier via two vectors. The first vector contains all the points and the second one contains the class labels. Note that the indices of the points and class labels should be the same. Such that, when we traverse the vector of points, we can always find out which class it belongs to, by just looking at the same position in the vector with class labels.