For those who get variables error for 'docs_example', please rename the documents into 'docs_example'.
And please add from sklearn.decomposition import NMF for the NMF part
and from sklearn.metrics.pairwise import cosine_similarity for the cosine_similarity