Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

PureSVD Collaborative Filtering

This component implements a ranking-focused anime recommender using binary likes and PureSVD. It replaces the earlier explicit-rating biased matrix factorization workflow as the active Collaborative Filtering method.

The active notebook is:

collaborative_filtering/02_svd_collaborative_filtering.ipynb

The repository now contains only the active PureSVD implementation. Trained model artifacts and processed datasets are kept locally and are not committed to Git.

1. Recommendation task

For each known user, the recommender:

  1. converts qualifying training ratings into binary likes;
  2. scores all 15,117 modelled anime;
  3. excludes every anime already observed in the relevant training split;
  4. ranks the remaining anime with raw PureSVD scores;
  5. returns the ten highest-scoring unseen anime.

PureSVD scores are preference-ranking scores. They are not predicted 1–10 ratings and are not clipped.

2. Two independent experimental protocols

The notebook preserves two separately trained models.

Primary unified LOO protocol

File Rows Purpose
loo_train.parquet 56,396,297 Primary model fitting and seen-item histories
loo_test.parquet 293,103 One held-out interaction per user

The primary model is fitted from loo_train_df only. The team-wide Top-10 evaluation hides one interaction per user and evaluates 8,000 deterministically selected eligible users.

Supplementary 8/1/1 protocol

File Rows Purpose
train.parquet 45,617,322 Supplementary model fitting and seen-item histories
val.parquet 5,536,039 Validation ranking evaluation
test.parquet 5,536,039 Final supplementary ranking evaluation

The supplementary model is fitted from train_df only. It is evaluated on 3,000 deterministic validation users and 8,000 deterministic test users.

Both protocols originate from the same cleaned interaction collection, but they define different held-out tasks. Their training frames are never combined, and their metric values must not be compared directly.

3. Binary feedback and PureSVD

A training interaction is a like when:

rating >= 7

The 8/1/1 training matrix contains 35,393,269 likes. The LOO training matrix contains 43,719,344 likes.

Let X be the sparse binary user-anime matrix. Randomized truncated SVD learns:

X ≈ U Σ Vt

A sparse user vector x is scored with:

x @ Vt.T @ Vt

Selected configuration:

Parameter Value
Like threshold rating >= 7
Latent factors 128
Algorithm randomized TruncatedSVD
Power iterations 5
Oversamples 10
Seed 42
Output Top-10

SciPy CSR matrices are used throughout. No dense user-item matrix is created.

4. Active implementation

collaborative_filtering/
├── 02_svd_collaborative_filtering.ipynb
├── README.md
└── src/
    ├── puresvd_model.py
    ├── puresvd_evaluation.py
    ├── puresvd_recommender.py
    └── utils.py
  • puresvd_model.py builds sparse binary matrices, fits PureSVD, scores users, saves and loads models, and implements the interaction-popularity baseline.
  • puresvd_evaluation.py performs deterministic batched full-catalogue ranking evaluation with complete seen-item exclusion.
  • puresvd_recommender.py generates metadata-mapped Top-10 recommendations.
  • utils.py validates the shared data and index contract.

5. Evaluation definitions

Both experiments report results for:

rating >= 7
rating >= 8

For every model comparison within one protocol:

  • the same eligible users and seed are used;
  • the full 15,117-anime catalogue is scored;
  • held-out items remain candidates;
  • every observed training item is excluded;
  • raw scores determine the ranking;
  • metrics are macro-averaged.

Reported metrics are Precision@10, Recall@10, NDCG@10, MAP@10, Hit Rate@10, and Coverage@10.

The baseline implemented in this standalone notebook is an interaction-popularity baseline. It counts every item occurrence in the corresponding training frame and gives every user the same global popularity scores before removing that user's seen items. This is different from the team's Members metadata baseline and Bayesian shrinkage baseline.

In LOO, each eligible user has one relevant item, so:

Recall@10 = Hit Rate@10
Precision@10 = Hit Rate@10 / 10

Those identities do not apply to the 8/1/1 protocol because users may have multiple relevant held-out items.

6. Verified primary LOO results

The primary LOO evaluation uses 8,000 deterministic eligible users. Each user has exactly one relevant held-out item.

Model Relevance Precision@10 Recall/HR@10 NDCG@10 MAP@10 Coverage@10
Interaction popularity rating >= 7 0.009038 0.090375 0.047824 0.035085 0.010650
PureSVD rating >= 7 0.030988 0.309875 0.200616 0.167016 0.098432
Interaction popularity rating >= 8 0.010050 0.100500 0.055910 0.042433 0.010320
PureSVD rating >= 8 0.032938 0.329375 0.211551 0.175301 0.098895

7. Verified supplementary 8/1/1 results

The supplementary 8/1/1 evaluation uses 3,000 deterministic validation users and 8,000 deterministic test users. A user may have multiple relevant held-out anime, so Precision@10, Recall@10, and Hit Rate@10 are separate quantities.

Validation

Model Relevance Precision@10 Recall@10 NDCG@10 MAP@10 HR@10 Coverage@10
Interaction popularity rating >= 7 0.088800 0.075962 0.111323 0.051565 0.516000 0.003837
PureSVD rating >= 7 0.205900 0.189015 0.269747 0.151053 0.806000 0.066878
Interaction popularity rating >= 8 0.072033 0.085904 0.099170 0.046633 0.457667 0.004234
PureSVD rating >= 8 0.168667 0.214872 0.244878 0.138188 0.761333 0.067209

Final test

Model Relevance Precision@10 Recall@10 NDCG@10 MAP@10 HR@10 Coverage@10
Interaction popularity rating >= 7 0.085512 0.076211 0.109649 0.051108 0.503375 0.004631
PureSVD rating >= 7 0.205038 0.193865 0.271180 0.152903 0.801625 0.075147
Interaction popularity rating >= 8 0.071988 0.087587 0.100136 0.047355 0.461250 0.004366
PureSVD rating >= 8 0.172287 0.217635 0.252079 0.143248 0.765375 0.074287

Validation and test results are close, and PureSVD substantially outperforms the matched interaction-popularity baseline on every reported ranking-accuracy metric.

8. Local artifacts

The two independent trained models are:

collaborative_filtering/artifacts/puresvd_k128_like_ge7.npz
collaborative_filtering/artifacts/puresvd_811_k128_like_ge7.npz

The primary LOO artifact was fitted from 43,719,344 binary training likes. The supplementary 8/1/1 artifact was fitted from 35,393,269 binary training likes.

Both artifacts are ignored by Git and are not required for teammates who only need to inspect the executed notebook and its recorded results.

9. Running the notebook

The notebook defaults to loading both existing models:

RUN_FULL_TRAINING = False
RUN_811_TRAINING = False

For one intentional replacement, enable only the relevant training switch and its matching overwrite switch. Return all switches to False after saving, then rerun the notebook to verify model loading and evaluation.

Other team members do not need either local artifact unless they intend to rerun this standalone component. The executed notebook records the verified configurations and results.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages