There's more...

We can also use the nearest-neighbor algorithm for evaluating unseen numbers from the user. Please see the online repository for a way to use this model to evaluate user input digits, at https://github.com/nfmcclure/tensorflow_cookbook.

In this chapter, we explored how to use k-NN algorithms for regression and classification. We discussed the different usages of distance functions, and how to mix them together. We encourage the reader to explore different distance metrics, weights, and k values to optimize the accuracy of these methods.

Get TensorFlow Machine Learning Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.