Vectorizing text
You'll now transform the volunteer dataset's title column into a text vector, which you'll use in a prediction task in the next exercise.
Questo esercizio fa parte del corso
Preprocessing for Machine Learning in Python
Istruzioni dell'esercizio
- Store the
volunteer["title"]column in a variable namedtitle_text. - Instantiate a
TfidfVectorizerastfidf_vec. - Transform the text in
title_textinto a tf-idf vector usingtfidf_vec.
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
# Take the title text
title_text = ____
# Create the vectorizer method
tfidf_vec = ____
# Transform the text into tf-idf vectors
text_tfidf = tfidf_vec.____(____)