MLNI – KNN (Sarah Tahir)

For this assignment, I looked at this code and tried to modify it to move a square around the screen using gesture. I spent a lot of time looking at ml5 examples using KNN classification because it was a little difficult for me to understand how to create/train my own model and then translate those results.

I used the WASD keys to save examples for Up, Down, Left, Right. K to save the model and L to start predicting. Once the model is ready to start predicting, the rect turns green. Then based on confidence I reconfigured posX and posY of the rect to move it around the screen. Finally, I added boundaries so that the rect would stay within the boundaries of the canvas.

Leave a Reply