简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM