July 2018
Beginner to intermediate
146 pages
3h 39m
English
The next steps are almost identical to the corresponding steps from the previous section.
Instead of using TF-IDFVectorizer, we will be using CountVectorizer. This is because using TF-IDFVectorizer will accord less weight to actors and directors who have acted and directed in a relatively larger number of movies.
This is not desirable, as we do not want to penalize artists for directing or appearing in more movies:
#Define a new CountVectorizer object and create vectors for the soupcount = CountVectorizer(stop_words='english')count_matrix = count.fit_transform(df['soup'])
Unfortunately, using CountVectorizer means that we are forced to use the more computationally expensive cosine_similarity function to compute ...
Read now
Unlock full access