converged and num_steps < max_steps: assign points to nearest cluster center update cluster centers to be the mean of the points assigned to it return cluster centers, memberships The algorithm
the training step (optimization) while num_steps > limit: grab next set of training data and labels perform training step evaluate on test data The algorithm (simplified)