This repository contains a solution for the text-based sequential recommendation competition. The goal is to predict the next item (parent_asin) a user will interact with, based on their interaction history and item metadata.
Baseline Performance: 0.02365
Solution (Recall@10): 0.03997
Rather than training a heavy neural model (like UniSRec), this solution employs a hybrid scoring system that combines interaction statistics with semantic text similarity. This approach effectively addresses the cold-start problem and handles long-tail items more robustly than raw ID-based methods.
- Data Processing & NLP Metadata Extraction: Parses titles, descriptions, brands, and categories from JSONL metadata.
Text Embeddings: Utilizes the all-mpnet-base-v2 model from SentenceTransformers to create high-dimensional vector representations of items. Similarity is calculated using Cosine Similarity.
- Transition Matrices & Statistics The algorithm computes several relationship types between items:
Item-to-Item: Direct transitions (likelihood of item Y following item X).
Brand/Category Transitions: Probability of moving to a specific item after interacting with a particular brand or category.
Co-occurrence: Frequent co-purchases within the same user session (order-independent).
Popularity: Global and brand-specific popularity used to backfill recommendations.
- Ensemble Scoring Logic The final recommendation list is generated by a weighted summation of scores from various sources:
Direct Transitions (Weight: 10.0): The strongest behavioral signal.
Semantic Similarity (Weight: 6.0): Recommending items with similar textual descriptions.
Brand Boosting (Weight: 6.0): Increased priority for items within the same brand (the most impactful feature of this solution).
Category & Co-occurrence: Secondary signals used to refine the ranking.
Python (Pandas, Numpy)
SentenceTransformers (SBERT) — for semantic analysis.
Scikit-learn — for cosine similarity calculations.
Collections (defaultdict) — for building transition graphs.