Skip to content

Commit 32b4f20

Browse files
authored
Update build-a-k-nearest-neighbor-model-with-p5js.mdx
1 parent 452e257 commit 32b4f20

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

projects/build-a-k-nearest-neighbor-model-with-p5js/build-a-k-nearest-neighbor-model-with-p5js.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,17 +228,21 @@ ellipse(mouseX, mouseY, 10, 10);
228228

229229
Now we just need to call it! At the bottom of the `draw()` function, call `classifyMouse()`. Feel free to move your mouse around and see if the classification is correct! Is your mouse pointer red when the majority of the 3 nearest neighbors are also red?
230230

231-
## Extensions:
231+
## Congrats!
232232

233-
You made a working KNN visualizer! Want to level it up? Try these challenges:
233+
Congrats on reaching the end of this project! You made a working KNN visualizer!
234+
235+
You now hopefully have a better understanding of how a K-Nearest Neighbor model works under the hood!
236+
237+
### Bonus Challenges
238+
239+
Want to level it up? Try these bonus challenges:
234240

235241
- We've hard-coded `20` points in our dataset and `3` nearest neighbors. Refactor your code so it is easy to quickly change those values to any numbers.
236242
- It can be a bit tough to eyeball which points are the nearest neighbors to your mouse. Edit your code so the nearest neighbors are now highlighted (maybe with a yellow border rather than black)
237243
- Add your own style! Rather than red and green points, you could draw your points as wizard 🧙‍♂️ or warrior ⚔️ emojis (calling back to our original example). Or come up with your own theme! Could you do something interesting with the background?
238244
- KNN models can work with multi-class problems. Rather than simply red and green points, what if you had red, green, and blue points? Refactor your code so your visualization works with _any_ number of classes.
239245

240-
Congrats on reaching the end of this project! You now hopefully have a better understanding of how a K-Nearest Neighbor model works under the hood!
241-
242246
### Additional Resources
243247

244248
- [p5.js](https://p5js.org)

0 commit comments

Comments
 (0)