Washington University Department of Electrical Engineering

Characterizing Odors Using Electronic

Nose Sensors

Classification: K-Nearest Neighbor

Coding and running the k-nearest neighbor algorithm in MATLAB then then plotting the classified points resulted in the figure below. The second figure additionally plots the known classification points as “o”. You can see that only a few points were classified incorrectly by the k-nn algorithm. Running the data through the algorithm correctly classified 95.96% of the data points. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The confusion matrix on the right confirms that the k-nn algorithm correctly classifies the majority of the data points. The first column shows that there are actually 33 almond points, but the algorithm classified two of them as hazelnuts. The algorithm has more of a tendency to “confuse” almonds and hazelnuts.