[Tech Insights] Decoding Shopper Identity: A Tree-Based Approach to Gender Prediction in E-Commerce
Customer gender prediction based on E-commerce data
The paper proposes a machine learning framework for predicting customer gender using e-commerce catalog viewing data. By representing product hierarchies as trees and extracting sequence-based features, the authors achieved a 81.2% Balanced Accuracy (BAC) and 81.4% Macro F1 score on the PAKDD’15 dataset.
TL;DR
In the world of e-commerce, knowing your customer is the first step toward effective personalization. However, most guest users don't leave a "paper trail" of demographic data. This paper presents a machine learning approach that predicts gender with over 81% accuracy by analyzing catalog viewing patterns. The secret sauce? Shifting from simple lists to tree-based structural features that capture the logic of how users navigate product categories.
Background: The Privacy Paradox
Personalization drives revenue, yet users are increasingly hesitant to share age, gender, or occupation. Traditional methods relied on "Author Profiling" (analyzing what users write), but most shoppers are silent browsers. The authors position this work as a solution for the "silent majority," using only the logs that systems collect by default: what was clicked, when, and in what order.
Problem & Motivation: Beyond the Clickstream
Previous works focused on what a user viewed. But is a product ID enough? The authors argue that the behavioral relationship between categories—the "Advanced Features"—is the true signal.
The challenge is twofold:
- Data Sparsity: Thousands of products but few clicks per session.
- Class Imbalance: In many datasets (like PAKDD'15), one gender significantly outnumbers the other, leading models to develop a "lazy bias" toward the majority class.
Methodology - The Structural Insight
1. The Tree-Based Representation
Instead of viewing a session as a flat list of IDs, the authors convert the hierarchical nature of e-commerce catalogs (Category > Sub-category > Product) into a tree structure.

From this tree, they extract:
- K-grams of nodes: Specific sequences of browsing within the same level.
- Node Transfer Pairs: How a user jumps across different hierarchy levels (e.g., from a specific product back to a broad category).
2. Handling Imbalance
With a 4:1 ratio of females to males, simple accuracy is a lying metric. The authors employed Cost-Sensitive Learning, applying a penalty (cost matrix) to the model for misclassifying the minority class, ensuring the "Balanced Accuracy" (BAC) remains high.
Experiments & Results
The researchers compared Random Forest, SVM, and BayesNet. Random Forest emerged as the clear winner.
Key Findings:
- Feature Synergy: Combining "Basic" (time/duration) with "Advanced" (tree sequences) features provided a consistent 3-4% boost in BAC.
- Optimal Feature Density: Through Information Gain-based selection, they found that 2,500 features represent the "sweet spot" before noise starts degrading the model.

In the figure above, we observe a steady climb in performance as structural features are added, highlighting the value of hierarchical data over raw IDs.
Critical Analysis & Conclusion
Takeaway
The primary contribution is the shift from viewing e-commerce data as a sequence of strings to viewing it as a traversal of a hierarchical manifold. This mirrors how humans actually think when shopping—narrowing down from broad interests to specific needs.
Limitations
A significant portion of sessions involves viewing only a single product. In these "single-click" scenarios, the "Advanced" sequence features provide zero value. Future work would need to integrate external embeddings (like Word2Vec for product descriptions) to handle these cold-start sessions.
Future Outlook
As we move toward a cookieless future, session-based identity inference will become the backbone of real-time marketing. Extending this tree-based logic to Deep Learning (Graph LSTMs) could be the next frontier in demographic prediction.
