The social signal that collaborative filtering ignores

Standard collaborative filtering asks: who has similar tastes to me? It ignores a far stronger signal: who do I actually trust? The Epinions dataset is uniquely suited to explore this - it has both 664K+ product reviews and an explicit social trust graph where users indicate who they trust.

The hypothesis: incorporating trust relationships alongside behavioral features should produce better personalised rankings than similarity-based methods alone. The dataset's sparsity (most users review only a handful of items) makes this even more important - trust relationships bridge the cold-start problem.

Dataset: Epinions - 664,824 reviews from 49,289 users across 139,738 items. Social trust graph with 487,183 directed trust edges. Sparsity ~99.99%. Rating scale 1–5.

From baselines to socially-aware MRF

Started with simple baselines, diagnosed their failures, then built up to the full Socially-Aware Markov Random Field model - each step justified by what the previous one couldn't capture.

Baseline: Jaccard Similarity

User-user and item-item Jaccard as the starting point. Fast to compute, interpretable - but ignores the trust graph entirely and degrades rapidly in high-sparsity conditions.

Baseline: Bayesian Logistic Regression

Treated recommendation as binary classification (high/low rating). Added user activity features and item popularity - better than Jaccard on AUC but still ignores social structure.

Feature Engineering (35+ features)

User behavioural: avg rating, review count, rating variance, recency. Item: popularity, avg rating, category. Social: in-degree trust, out-degree trust, mutual trust count, 2-hop trust path count.

Socially-Aware MRF

A Markov Random Field where each user's preference is influenced by both their own history and the preferences of users they trust - inspired by the SBMC framework. The joint probability over user preferences incorporates social graph structure directly into the model.

Evaluation: AUC Ranking

Primary metric: AUC for distinguishing high (≥4) vs low (≤2) rated items. MRF outperforms both Jaccard and Bayesian LR - the improvement is largest for users with rich trust networks.

Hugging Face Demo

Built an interactive Streamlit demo deployed to Hugging Face Spaces - enter a user ID, get personalised recommendations with explanations showing which trust connections influenced the result.

# Core social feature: weighted trust influence on rating prediction
def social_prior(user_id, item_id, trust_graph, ratings):
    trusted_users = trust_graph.successors(user_id)
    trusted_ratings = [ratings.get((u, item_id)) for u in trusted_users
                       if ratings.get((u, item_id)) is not None]
    if not trusted_ratings:
        return global_mean  # fallback if no trusted reviews
    return np.mean(trusted_ratings)  # trust-weighted average

What made this hard

Challenge
Extreme sparsity

99.99% of user-item pairs have no rating. Most similarity-based methods collapse under this sparsity - it's why social trust as a bridge signal is so valuable.

Challenge
Graph computation at scale

Computing 2-hop trust paths for 49K users was expensive. We precomputed trust influence matrices using NetworkX with aggressive caching rather than computing on-the-fly.

Challenge
Cold-start users

Users with few reviews and no trust connections get weak recommendations. We fell back to global popularity ranking for these cases - a known limitation of social approaches.

Challenge
Evaluation fairness

Ensuring the test set didn't leak social network information was tricky - trust edges implicitly encode who reviewed what, so train/test splitting required time-based ordering.

Technologies Used

ComponentTool & Purpose
LanguagePython - data processing, feature engineering, model implementation
Graph ProcessingNetworkX - trust graph construction, traversal, feature extraction
ML / Baselinesscikit-learn - Logistic Regression, AUC scoring, cross-validation
Data LibrariesPandas & NumPy - preprocessing and feature computation
Advanced ModelCustom Markov Random Field - socially-aware probabilistic recommendation
DemoStreamlit + Hugging Face Spaces - interactive recommendation interface
DatasetEpinions - 664K+ reviews, 487K trust edges

Results

664K+
Epinions reviews processed
35+
engineered features per user-item pair
MRF
beats Jaccard + Bayesian LR on AUC
  • Social trust signal measurably improves ranking quality over similarity-only baselines
  • Improvement largest for users with well-connected trust networks - validates the hypothesis
  • Live Hugging Face demo lets anyone explore personalised recommendations with social explanations
  • 35+ features provide a reusable feature library for future social recommendation work

What I took away

  • Social signals are most valuable exactly where collaborative filtering struggles most - sparse data, cold-start users, niche items.
  • Precomputing graph features (trust paths, centrality) is essential at this scale - lazy computation in a training loop is prohibitively slow.
  • AUC is the right metric for ranking problems, not accuracy - "did you recommend the right items in the right order" matters more than "did you predict the exact rating".
  • Building a live demo early forces you to think about latency and usability, not just offline model performance.