How to Solve NameError: name 'cosine_distances' is not defined -- sklearn

Solution: Import the 'cosine_distances' module

To Solve the error, add the following line to the top of your code.

from sklearn.metrics.pairwise import cosine_distances

 

For more information:
Python sklearn cosine_distances