Course contentsShow
← Data Science
Lesson 1707 of 2,14540. Customer and Product AnalyticsFree lesson

Feature Engineering for Segmentation

Creating meaningful features from raw data: aggregations, ratios, time-based patterns, and derived metrics.

Feature Engineering for Segmentation

You'll learn how to transform raw customer data into meaningful features that reveal hidden segments and patterns.

What is Feature Engineering for Segmentation?

Feature engineering is the art of creating new, informative variables from your existing data to make customer segments more distinct and actionable. Raw data rarely tells the full story—a timestamp is just a number until you extract "days since last purchase" or "weekend shopper vs. weekday shopper."

Think of it like a chef preparing ingredients: raw vegetables (your data) need to be chopped, combined, and seasoned (engineered) before they become a great dish (useful segments).

Core Feature Types

Aggregations

Summarize behavior over time: total purchases, average order value, count of support tickets. These create a baseline profile for each customer.

Ratios and Rates

Compare metrics to reveal behavior patterns: return_rate = returns / total_orders, mobile_usage_pct = mobile_sessions / total_sessions. Ratios normalize for activity level and highlight preferences.

Time-Based Patterns

Extract temporal signals: days_since_last_login, purchase_hour_of_day, weekend_activity_ratio. These capture engagement rhythms and recency effects.

Derived Metrics

Combine multiple fields: revenue_per_session = total_revenue / session_count, engagement_velocity = (current_month_logins - last_month_logins) / last_month_logins. These create composite indicators of customer health.

Why This Matters

Well-engineered features make clustering algorithms work better. Instead of clustering on raw transaction counts (which favor high-volume customers), features like "average days between purchases" or "product category diversity" reveal behavioral nuances. A customer who buys once monthly for three years is very different from one who made 36 purchases in one month—same count, different loyalty.

Key Takeaway: Feature engineering transforms raw data into meaningful signals by creating aggregations, ratios, time-based patterns, and derived metrics that expose the true behavioral differences between customer segments.