Support hyper-parameter search for next-item recommenders (#643)#702
Open
nsiddharth wants to merge 1 commit into
Open
Support hyper-parameter search for next-item recommenders (#643)#702nsiddharth wants to merge 1 commit into
nsiddharth wants to merge 1 commit into
Conversation
…I#643) GridSearch/RandomSearch could not tune NextItemRecommender models evaluated with NextItemEvaluation: - NextItemEvaluation.evaluate() rejected the search wrapper because it is a Recommender, not a NextItemRecommender. - BaseSearch.fit() scored next-item models with the standard ranking_eval, whose rank()/score() path is incompatible with the session-based score(history_items=...) signature. Fix: - Accept a search wrapper whose .model is a NextItemRecommender. - Route next-item models through next_item_evaluation.ranking_eval during search, using the eval_method's exclude_unknowns/mode. - Delegate transform/score/rank from BaseSearch to the best model so the fitted wrapper evaluates transparently. Add GridSearch/RandomSearch next-item tests.
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
GridSearchandRandomSearch(cornac.hyperopt) could not be used to tuneNextItemRecommendermodels evaluated withNextItemEvaluation. Two issues blocked it:The search wrapper was rejected by the evaluator.
NextItemEvaluation.evaluate()requires itsmodelto be aNextItemRecommender, but aGridSearch/RandomSearchobject is aRecommenderwrapper, not aNextItemRecommender. It raised:The search loop scored next-item models with the wrong evaluator. Inside
BaseSearch.fit, ranking metrics fell through to the standardranking_eval, whoserank()/score()path is incompatible with the session-based signaturescore(user_idx, history_items, ...):Fix:
NextItemEvaluation.evaluate()now also accepts a search wrapper whose.modelis aNextItemRecommender.BaseSearch.fit()routesNextItemRecommendercandidates throughnext_item_evaluation.ranking_eval, passing the eval method'sexclude_unknownsandmode.BaseSearchdelegatestransform/score/rankto the selectedbest_model, so the fitted wrapper evaluates transparently on the test set.This is additive — the existing rating/standard-ranking search paths are unchanged (verified by the pre-existing
test_grid_search/test_random_search).Related Issues
Fixes #643.
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).