Line 1: Line 1:
 
I found a MATLAB [http://www.mathworks.com/matlabcentral/fileexchange/15562-k-nearest-neighbors function] for finding the k-nearest neighbors (kNN) within a set of points, which could be useful for homework 3.
 
I found a MATLAB [http://www.mathworks.com/matlabcentral/fileexchange/15562-k-nearest-neighbors function] for finding the k-nearest neighbors (kNN) within a set of points, which could be useful for homework 3.
  
I tried it and it works well. I did some experiments using the Wine data set of UCI (http://archive.ics.uci.edu/ml/datasets.html). I used attributes 1 and 7 of the red wine data set (red points) and the white wine data set (grey points). For this simple experiment, I used only the first 100 data points of each set. The following figures show the classification regions using k=1, 3, 7. The red wine region is brown and the white wine region is white. The regions are constructed using MATLAB's contourf function.
+
I tried it and it works well. I did some experiments using the Wine data set of UCI (http://archive.ics.uci.edu/ml/datasets.html). I used attributes 1 and 7 of the red wine data set (red points) and the white wine data set (grey points). For this simple experiment, I used only the first 100 data points of each set. The following figures show the classification regions using k=1, 3, 7. The red wine region is brown and the white wine region is white. The regions are constructed using MATLAB's [http://www.mathworks.com/access/helpdesk/help/techdoc/ref/contourf.html contourf] function.
  
 
[[Image:nn_k_1.jpg]] [[Image:nn_k_3.jpg]] [[Image:nn_k_7.jpg]]
 
[[Image:nn_k_1.jpg]] [[Image:nn_k_3.jpg]] [[Image:nn_k_7.jpg]]
  
 
--[[User:ilaguna|ilaguna]] 15:40, 7 April 2010 (UTC)
 
--[[User:ilaguna|ilaguna]] 15:40, 7 April 2010 (UTC)

Revision as of 10:42, 7 April 2010

I found a MATLAB function for finding the k-nearest neighbors (kNN) within a set of points, which could be useful for homework 3.

I tried it and it works well. I did some experiments using the Wine data set of UCI (http://archive.ics.uci.edu/ml/datasets.html). I used attributes 1 and 7 of the red wine data set (red points) and the white wine data set (grey points). For this simple experiment, I used only the first 100 data points of each set. The following figures show the classification regions using k=1, 3, 7. The red wine region is brown and the white wine region is white. The regions are constructed using MATLAB's contourf function.

Nn k 1.jpg Nn k 3.jpg Nn k 7.jpg

--ilaguna 15:40, 7 April 2010 (UTC)

Alumni Liaison

Questions/answers with a recent ECE grad

Ryne Rayburn