simple_preference_model

Simple user preference modeling component.

This class implements the “single item preference” approach in [Zhang & Balog, KDD’20].

  • Whenever a user is prompted whether they had seen/consumed a specific item, we answer that based on historical data.

  • Whenever the user is prompted for their preference on a given item or slot-value pair, we provide a positive/negative response by flipping a coin (i.e., either -1 or +1 as the preference).

  • Whenever the user is prompted for a preference on a given slot, a random value among the existing slot values is picked and returned as positive preference.

The responses given are remembered so that the user would respond the same way if they are asked the same question again.

This approach offers limited consistency. Items that are seen/consumed are rooted in real user behavior, but the preferences expressed about them are not. Hence, the user might express a preference about a slot that is inconsistent with the answers given to other questions (e.g., likes “action” as a genre, but has not seen a single action movie).

Classes

SimplePreferenceModel

Initializes the simple preference model of a simulated user.

Module Contents

class simple_preference_model.SimplePreferenceModel(domain: usersimcrs.core.simulation_domain.SimulationDomain, item_collection: usersimcrs.items.item_collection.ItemCollection, historical_ratings: usersimcrs.items.ratings.Ratings, historical_user_id: str = None)

Bases: usersimcrs.user_modeling.preference_model.PreferenceModel

Initializes the simple preference model of a simulated user.

Parameters:
  • domain – Domain.

  • item_collection – Item collection.

  • historical_ratings – Historical ratings.

  • historical_user_id (Optional) – If provided, the simulated user is based on this particular historical user; otherwise, it is based on a randomly sampled user. This is mostly added to make the class testable. Defaults to None.

get_item_preference(item_id: str) float

Returns a preference for a given item.

Parameters:

item_id – Item ID.

Returns:

Randomly chosen preference, which is either -1 or +1.

Raises:

ValueError – If the item does not exist in the collection.

get_slot_value_preference(slot: str, value: str) float

Returns a preference on a given slot-value pair.

Parameters:
  • slot – Slot name (needs to exist in the domain).

  • value – Slot value.

Returns:

Randomly chosen preference, which is either -1 or +1.