Add FPMC model and model selection for NextItemRecommender#698
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds the FPMC (Factorizing Personalized Markov Chains) next-item model, introduces an opt-in best-on-validation model selection mechanism shared by sequential models (also wired into GRU4Rec), and switches the Diginetica load_val/load_test defaults to a clean session-based held-out split (with a mode="session-aware" opt-in to recover the previous cumulative files).
Changes:
- New
FPMCmodel (cornac/models/fpmc/) with a Torch implementation, registration incornac.models, README entry, and a Diginetica example. - New shared
val_scorehelper incornac/models/seq_utils/selection.pyand best/lastmodel_selectionplumbing in both FPMC and GRU4Rec. cornac/datasets/diginetica.pyload_val/load_testgain amodeparameter (default'session-based'pointing to new*_sbr.zipURLs); test expectations updated accordingly.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Adds FPMC row to the models table. |
| cornac/datasets/diginetica.py | Adds mode arg to load_val/load_test; new _sbr URLs. |
| cornac/models/init.py | Exposes FPMC from the package. |
| cornac/models/fpmc/init.py | Re-exports FPMC. |
| cornac/models/fpmc/recom_fpmc.py | New FPMC recommender with training loop and best-on-val selection. |
| cornac/models/fpmc/fpmc.py | Torch module computing <UI,IU> + <IL,LI> + bias. |
| cornac/models/fpmc/requirements.txt | torch>=1.12.0. |
| cornac/models/gru4rec/recom_gru4rec.py | Adds model_selection, val_eval_every, val_k, val_metric; restores best state. |
| cornac/models/seq_utils/init.py | Re-exports val_score. |
| cornac/models/seq_utils/selection.py | Helper that delegates to next_item_evaluation.ranking_eval. |
| examples/fpmc_diginetica.py | Quick-start example for FPMC on Diginetica. |
| tests/cornac/datasets/test_diginetica.py | Updates expected sizes for the new session-based defaults and asserts session-aware sizes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
Author
|
Some quick results for Validation
Test
|
5 tasks
qtuantruong
approved these changes
Jun 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
On the Diginetica dataset, the original data format and purpose were for session-aware recommendation. So for each user, beside the leave-one-session-per-user eval/test session, we also have the training session for that user (e.g., HGRU4Rec may feed those training sessions into a user-RNN, feed the test session into session-RNN, and combine those two). So for session-based, to minimize the changes in data loader and iteration, we add new URLs to load val/test set specifically for session-based.
Related Issues
Checklist:
README.md(if you are adding a new model).examples/README.md(if you are adding a new example).datasets/README.md(if you are adding a new dataset).