Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plotting a decision boundary in matlab

I have two classes of data which are plotted in 2D and I wish to plot the nearest-neighbours decision boundary for a given value of k.

I realise that there is a similar example provided in Matlab's 'classify' help doc, however I do not see how I can use this within the context of k nearest-neighbours.

Thanks,

Josh

like image 372
Josh Avatar asked Mar 20 '11 20:03

Josh


1 Answers

I think since you are in 2D space easiest would be to do the brute force approach, iterate over all (x,y) at a fixed resolution. For each point determine its class (or likelihood) and plot the values as an image.

like image 118
fairidox Avatar answered Nov 03 '22 03:11

fairidox