Building solution boundaries in Matlab

I have two data classes that are built in 2D, and I want to build the boundary of the solution of the nearest neighbors for a given value of k.

I understand that there is a similar example provided in the Matlab 'classify' help doc, however I do not see how I can use it in the context of k nearest neighbors.

Thanks,

Josh

+4
source share
1 answer

I think that since you are in 2D space the easiest way is to make brute force approach, iterate over all (x, y) with a fixed resolution. For each point, they determine their own class (or likelihood) and build the values ​​as the image.

+10
source

Source: https://habr.com/ru/post/1344495/


All Articles