internalsGet Pro

Module 11 · Lesson 6 of 13Pro

Text features: from word counts to embeddings

Level
Intermediate
Topic
Data preparation and feature engineering
Reading time
17 min

When you finish this page you can

  1. Turn review text into a sparse TF-IDF matrix with scikit-learn, with the vocabulary learned from training rows only.
  2. Work out a TF-IDF weight by hand and explain why rare words count for more than common ones.
  3. Add pretrained sentence embeddings as features and name what they cost at training and at scoring time.
  4. Choose between TF-IDF and embeddings by testing both on validation, knowing when varied wording and few labels favour embeddings.

Builds on 3 lessons

Start with lesson 314 min
  1. Encoding categories as numbers14 min
  2. Learned embeddings: vectors for words, items and users18 min
  3. Pretraining and fine-tuning16 min

Four stars, and the customer was gone

is our example online store. Its ML team works on a notebook sample of about 1 million orders from 200,000 customers. Every Monday, a model ranks those customers by how likely they are to stop buying, and Joseph’s growth team sends vouchers to the top 20,000.

Our biggest sale ever · Black Friday

Flat 50% Off

Pro

Continue reading

Unlock every course, now and later

  • System Design, live
  • AI Engineering, live
  • Data Engineering, live
  • Machine Learning Engineering, live
  • Inference Engineering, coming soon
  • AI Research, coming soon
  • Performance Engineering, coming soon
  • Agent & Harness Engineering, coming soon
  • LLM Fine-tuning, coming soon
  • LLM Pre-training & Post-training, coming soon
  • Reinforcement Learning, coming soon
  • AI Infrastructure & Platform Engineering, coming soon
  • AI Evaluation & Safety, coming soon
  • Forward Deployed Engineering, coming soon
  • Cloud Computing, coming soon
  • DevOps, coming soon

50% off · Annual and Lifetime

BLACKFRIDAY50Applied at checkout

Choose a plan