Skip to content

Commit 8a42b6f

Browse files
authored
Update build-a-k-nearest-neighbor-model-with-p5js.mdx
1 parent 62bf042 commit 8a42b6f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ Here are the steps to do this:
176176

177177
Let's get started!
178178

179-
### Step 3.1: Measure Distances:
179+
### Step 3.1: Measure Distances
180180

181181
We need to find the distance between our mouse pointer and each `Point` in our dataset. We'll put each distance in an array. Let's begin by creating an empty array and setting up our `for` loop:
182182

@@ -202,7 +202,7 @@ Finally, we don't want to simply add the distance to our list. We need to add th
202202
distances.push([distance, points[i].class]);
203203
```
204204

205-
### Step 3.2: Sort the Distances:
205+
### Step 3.2: Sort the Distances
206206

207207
We now need to find the 3 closest points. The easiest way to do this is by sorting our list of distances from low-to-high and looking at the first 3 points in our list.
208208

@@ -232,7 +232,7 @@ for (var i = 0; i < 3; i++) {
232232
}
233233
```
234234

235-
### Step 3.4: Draw a Circle Based on Classification:
235+
### Step 3.4: Draw a Circle Based on Classification
236236

237237
We now know whether the mouse should be classified as red or green. Let's draw a small circle at the location of the mouse with the correct color. This should be the end of your `classifyMouse()` function, outside of all loops:
238238

0 commit comments

Comments
 (0)