The business problem: staffing Blinkit's stores
What it is
Blinkit wants each dark store to have the right number of delivery partners. It sorts stores into three classes by how much they deliver: Class 1, High traffic (many partners), Class 2, Moderate and Class 3, Low (very few). Each store is described by its Region (Tier-1, 2 or 3 city) and its delivery counts for Fresh, Milk, Grocery, Frozen, Detergents_Paper and Delicassen. When a new store opens, which class does it belong in?
Why it matters
Three facts about this data decide which model can work. It is multi-class (three answers, not two). It is imbalanced (far fewer High-traffic stores than the others). And when you plot it, the classes curl around each other, so it is non-linear — no straight line separates them. Keep these three in mind; the rest of the module is about a model that handles all three.
In the real world: A quick-commerce company decides how many delivery partners each dark store needs by classifying stores as high, moderate or low traffic.
Visual example
value_counts()The stores per class. Class 1 has half as many examples as the other two — the data is multi-class and imbalanced.
440 stores in all: 87 + 180 + 173.
import pandas as pd
df = pd.read_csv("multiclass.csv")
df.head()
# Region Fresh Milk Grocery Frozen Detergents_Paper Delicassen class
df["class"].value_counts().sort_index()
# 1 87 <- High traffic: the smallest class
# 2 180
# 3 173Reading the class numbers 1, 2, 3 as amounts. They are labels, not quantities: Class 3 is not "three times" Class 1, and a model must never average them. Treat them as categories.