There's more...

For this recipe, we clustered the iris dataset into three groups using TensorFlow. Then, we calculated the percentage of data points that fell into similar groups (89%) and plotted a graph of the resulting k-means groups. Since k-means as a classification algorithm is locally linear (linear separator up close), it will be hard to learn the naturally non-linear boundary between Iris versicolor and Iris virginica. But, one advantage is that the k-means algorithm did not need labeled data at all to perform.

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.