rime.models.zero_shot.bayes_lm.BayesLM

class rime.models.zero_shot.bayes_lm.BayesLM(item_df, max_num_candidates=None, batch_size=100, prompt='a user will watch {y} after watching {x}', item_pop_power=1, item_pop_pseudo=0.01, temperature=1, gamma=0, candidate_selection_method=None, model_name='gpt2', text_column_name='TITLE')[source]

Bases: object

p(y|x) propto lm(x|y) * p(y), where x is the last item in user history and y is a candidate item.

https://huggingface.co/docs/transformers/v4.15.0/en/model_doc/auto

__init__(item_df, max_num_candidates=None, batch_size=100, prompt='a user will watch {y} after watching {x}', item_pop_power=1, item_pop_pseudo=0.01, temperature=1, gamma=0, candidate_selection_method=None, model_name='gpt2', text_column_name='TITLE')[source]

Methods

__init__(item_df[, max_num_candidates, ...])

transform(D)

generate score matrix by evaluating top or random items in test

transform(D)[source]

generate score matrix by evaluating top or random items in test