Text vectorization
You'll now transform the desc column in the UFO dataset into tf/idf vectors, since there's likely something we can learn from this field.
Bu egzersiz
Preprocessing for Machine Learning in Python
kursunun bir parçasıdırEgzersiz talimatları
- Print out the
.head()of thedesccolumn. - Instantiate a
TfidfVectorizer()object. - Fit and transform the
desccolumn usingvec. - Print out the
.shapeof thedesc_tfidfvector, to take a look at the number of columns this created.
Uygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
# Take a look at the head of the desc field
print(____)
# Instantiate the tfidf vectorizer object
vec = ____
# Fit and transform desc using vec
desc_tfidf = vec.____
# Look at the number of columns and rows
print(____.shape)