The K-Nearest Neighbor code in Tensorflowjs is fairly easy. It is just calculating the distance between two points on a
graph. In 2D it would just be the distance formula, kind of like the pythagoras equation for the hypotenus of a right triangle
c = square root of (a squared + b squared).
Lets try a 3, 4, 5 triangle: If the graph starts at location 0,0 and go 3 along the x axis and 4 up, what is the unknown
distance from the origin to this 3, 4 location
Look at how bareable the code is:
...
Same thing as above but stringing the operations together in one line which is strangely easier to read