How to manually draw a $k$-NN decision boundary with $k=1$ knowing the dataset
the labels are
and the euclidean distance between two points is defined as
Artificial Intelligence Stack Exchange is a question and answer site for people interested in conceptual questions about life and challenges in a world where "cognitive" functions can be mimicked in purely digital environment. It only takes a minute to sign up.
Sign up to join this communityHow to manually draw a $k$-NN decision boundary with $k=1$ knowing the dataset
the labels are
and the euclidean distance between two points is defined as
This is a rather involved task. What to do from a high-level theoretical perspective might be easy to see, but it's difficult putting that into code from scratch.
Doing this in Python using existing libraries in not too complicated, though. See for example this tutorial or this StackOverflow post.
Edit:
Theoretically, I would first plot (draw) the points from your dataset in a graph and then watch out for "decision points" half-way in between any two near-by points (from the dataset) from distinct classes.
For the next step, keep in mind those decision points. Given close-by data points from classes (e.g.) A and B, imagine a straight line connecting these two points from separate classes. Next, take the point half-way along that imaginary line (i.e. your decision point) and draw a "soft" line (maybe using pencil instead of pen) orthogonal/perpendicular to that imaginary line which intersects the imaginary line in the decision point. Do that for all combinations of "reasonably" close points from different classes.
Parts of the lines you have just drawn will define the final decision boundary. Next, think of each line as consisting of multiple elements, which are separated from one another by means of the points of intersection with other drawn lines. In other words, split lines into elements wherever they intersect other lines. Now, decide which of these elements to outline as the eventual decision boundary (finally using a pen instead of pencil). This step simply involves human intelligence and is difficult to describe. Whenever a line's element accurately separates (logically speaking) two classes, indicate it using a pen. Otherwise, if it does not contribute to separating two classes, don't indicate it.
After having indicated the final decision boundary using a pen, simply erase the pencil drawings. Now, you should be left with a decision boundary.
I hope this is clear and accurate enough.