Ravindra BagaleCourses & study guides मराठी Track your progress

32. Features and Labels in Machine Learning

Data Science

32.2 Numeric, Category and Text Features

Why. Not every column is the same kind of feature. Models treat numbers and text differently (details grow in later chapters).

What.

  • Numeric features — counts, ₹ amounts, km, minutes.
  • Category features — city name, payment mode, store id (limited set of labels).
  • Text features — review sentences, complaint notes (need special prep; NLP block later).

How.

  1. List each column and mark numeric / category / text / ignore.
  2. For first ML models (ch33+), start with numeric (+ simple categories).
  3. Leave long free text for the NLP chapters unless your mentor says otherwise.
import pandas as pd

row = {
 "items": 4, # numeric
 "distance_km": 3.2, # numeric
 "city": "Pune", # category
 "payment": "UPI", # category
 "note": "please call at gate", # text — later
}
print(row)

Ravindra Bagale's Tip

Start with numeric features, because they are the easiest to use in a model. Add category features after that, and move to text features only when the basics work well. A strong base of simple features will help you more than a quick jump to difficult ones.