Skip to content

Commit cf055ee

Browse files
authored
Update build-a-k-nearest-neighbor-model-with-p5js.mdx
1 parent 226fa62 commit cf055ee

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ tags:
3838
**Versions:** None
3939
**Read Time:** 45 minutes
4040

41-
## Machine Learning Models and KNN
41+
## Introduction
4242

4343
Machine Learning might sound complex, but many of the core ideas aren't actually too tricky! One of the most common ML models is **K-Nearest Neighbors** (KNN).
4444

@@ -68,7 +68,21 @@ Now, we’ll create a new character at the position of your mouse. Should they b
6868

6969
As you move your mouse around, it’s like you’re designing hundreds of new characters and watching KNN decide their team instantly. See how our mouse pointer flips between drawing a red circle and green circle based on the 3 nearest points?
7070

71+
## KNN
7172

73+
Before we get started coding, let's learn about KNN real quick.
74+
75+
KNN is a simple machine learning algorithm that:
76+
77+
1. Looks at the `K` closest data points (neighbors) to a new data point.
78+
2. Uses those neighbors to predict what group the new data point belongs to.
79+
80+
That's why it's called K-Nearest Neighbors:
81+
82+
- If `K` is 3, we are looking at 3 closest neighbors.
83+
- If `K` is 5, we are looking at 5 closest neighbors.
84+
85+
Easy to remember, right?
7286

7387
### Step 1: Creating the Points Class
7488

0 commit comments

Comments
 (0)