Skip to content

[ASK] API of NextBasketRecommender #662

@buhrmann

Description

@buhrmann

Hi, first of all thanks so much for the work you put in this project! I'm currently trying to use it for a quick improvement of baseline recommendations for a client of ours. I have a couple of simple questions related to the usage of NextBasketRecommenders.

Firstly, currently they don't seem to support the .recommend(user_id, k) API. This is because the Recommender class currently doesn't allow passing of extra **kwds, which would be necessary for subsequent calls of the rank(...) and score(...) methods to receive the history_baskets parameter. Is there any reason for not supporting the recommend() method? I was kind of expecting this as the main API for predicting the next basket.

Alternatively, I guess one can use the sort and rank methods directly. But from what I've seen in the next_basket_evaluation code, this seems to be very laborious:

item_rank, item_scores = model.rank(
            user_idx,
            item_indices,
            history_baskets=history_baskets,
            history_bids=bids[:-1],
            uir_tuple=test_set.uir_tuple,
            baskets=test_set.baskets,
            basket_indices=test_set.basket_indices,
            extra_data=test_set.extra_data,
        )

On this note, even the score() method requires manually passing the history_baskets parameter, and this is not documented. It's supposed to be a list of lists, but of product ids or original index values? For only the requested user or for all users? And in general, if the model was trained already with a dataset of baskets, why do I need to pass in something that's already in the dataset (or alternatively a separate test dataset)? Is there a simple way of extracting the required history_baskets from a dataset?

Maybe a simple example of a model fit -> predict/recommend scenario would be useful in the docs, in addition to the more complete Evaluation example.

Metadata

Metadata

Assignees

Labels

featureNew feature/enhancement request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions