Plotting a decision boundary in matlab
I have two classes of data which are plotted in 2D and I w开发者_运维知识库ish 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
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.
精彩评论