TED talk recommender
In this exercise, we will build a recommendation system that suggests TED Talks based on their transcripts. You have been given a get_recommendations()
function that takes in the title of a talk, a similarity matrix and an indices
series as its arguments, and outputs a list of most similar talks. indices
has already been provided to you.
You have also been given a transcripts
series that contains the transcripts of around 500 TED talks. Your task is to generate a cosine similarity matrix for the tf-idf vectors of the talk transcripts.
Consequently, we will generate recommendations for a talk titled '5 ways to kill your dreams' by Brazilian entrepreneur Bel Pesce.
Diese Übung ist Teil des Kurses
Feature Engineering for NLP in Python
Anleitung zur Übung
- Initialize a
TfidfVectorizer
with English stopwords. Name ittfidf
. - Construct
tfidf_matrix
by fitting and transformingtranscripts
. - Generate the cosine similarity matrix
cosine_sim
usingtfidf_matrix
. - Use
get_recommendations()
to generate recommendations for '5 ways to kill your dreams'.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Initialize the TfidfVectorizer
tfidf = ____
# Construct the TF-IDF matrix
tfidf_matrix = ____
# Generate the cosine similarity matrix
cosine_sim = ____
# Generate recommendations
print(get_recommendations(____, ____, indices))