From the course: Building Recommender Systems with Machine Learning and AI
Unlock this course with a free trial
Join today to access over 23,200 courses taught by industry experts.
Exercise solution: Implement a stoplist - Python Tutorial
From the course: Building Recommender Systems with Machine Learning and AI
Exercise solution: Implement a stoplist
- [Instructor] Okay, so if you open up my RBMAlgorithm.py file in the Challenges folder of the course materials, you'll see how I went about implementing the stop list. In the init function, I've loaded up the MovieLens module because we need it for looking up movie titles from movie IDs. We've also defined a very small stop list here, containing just the terms sex, drugs, and rock n roll. This obviously isn't a real stop list. You should put a lot more thought into yours, and make sure it includes the roots of words and not specific tenses or variations of them. For example, in a real stop list, I'd stop list drug and not drugs to catch as many drug-related words as possible. Next, we have the buildStoplist function on line 26. All we're doing here is building up a dictionary that lets us quickly look up if a given item ID is banned or not. We iterate through every item in our training set, convert it to a raw item ID, and look up its title. If it has a title, we first convert that…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
-
-
-
(Locked)
The cold start problem (and solutions)6m 12s
-
(Locked)
Implement random exploration54s
-
(Locked)
Exercise solution: Random exploration2m 18s
-
(Locked)
Stoplists4m 48s
-
(Locked)
Implement a stoplist32s
-
(Locked)
Exercise solution: Implement a stoplist2m 22s
-
(Locked)
Filter bubbles, trust, and outliers5m 39s
-
(Locked)
Identify and eliminate outlier users44s
-
(Locked)
Exercise solution: Outlier removal4m
-
Fraud, the perils of clickstream, and international concerns4m 33s
-
(Locked)
Temporal effects and value-aware recommendations3m 30s
-
(Locked)
-
-
-