K Nearest Neighbor in TF v2

As I am going through the Google Developer Expert process I was asked with coding up KNN in TensorFlow. I couldn’t find an example online so I decided to create it.

The gist was that I could use *tf.math.squared_difference* to measure the difference. Then, I used reduce_sum to combine the 4 feature differences to a single number. Then, I would reverse the values using tf.negative and call tf.math.top_k to grab the nearest. Pretty straight forward.

GitHub: https://github.com/ehennis/Blog/blob/master/TensorFlow/K_Nearest_Neighbor.ipynb

YouTube: https://youtu.be/dA7QK80jTzA

YouTube: Binary Classification

Video 1: Binary Classification.

In this video I walk through a side project I worked on for a friend. I took 8 games worth of football plays and tried to predict the next play. It was interesting to work from scratch on a project like this. In the end I was pretty happy with how it turned out. We will see next fall if it adds any real value though!