as we have learned previouslywe will first have to vectorize this post before we predict its label as followsnew_post_vec vectorizer transform([new_post]new_post_label km predict(new_post_vec)[ now that we have the clusteringwe do not need to compare new_post_vec to all post vectors insteadwe can focus only on the posts of the same cluster let us fetch their indices in the original datasetsimilar_indices (km labels_==new_post_labelnonzero()[ the comparison in the bracket results in boolean arrayand nonzero converts that array into smaller array containing the indices of the true elements using similar_indiceswe then simply have to build list of posts together with their similarity scores as followssimilar [for in similar_indicesdist sp linalg norm((new_post_vec vectorized[ ]toarray()similar append((distdataset data[ ])similar sorted(similarprint(len(similar) we found posts in the cluster of our post to give the user quick idea of what kind of similar posts are availablewe can now present the most similar post (show_ at_ )the least similar one (show_at_ )and an in-between post (show_at_ )all of which are from the same cluster as followsshow_at_ similar[ show_at_ similar[len(similar)/ show_at_ similar[-