Skip to content

Preference learning

Step 2 in pipeline

Preference learning infers, for each user and based on their data, a model of the user's preferences. This corresponds to the idea of "algorithmic representatives", which will participate in the digital democracy to remedy users' lack of activity and reactivity.

PreferenceLearning

Bases: ABC

__call__

__call__(judgments: Judgments, users: DataFrame, entities: DataFrame, initialization: Optional[dict[int, ScoringModel]] = None, new_judgments: Optional[Judgments] = None) -> dict[int, ScoringModel]

Learns a scoring model, given user judgments of entities

Parameters:

Name Type Description Default
judgments Judgments

May contain different forms of judgments, but most likely will contain "comparisons" and/or "assessments"

required
entities DataFrame
  • entity_id: int, index
  • May contain others, such as vector representation
required
initialization Optional[dict[int, ScoringModel]]

Starting models, added to facilitate optimization It is not supposed to affect the output of the training

None
new_judgments Optional[Judgments]

New judgments This allows to prioritize coordinate descent, starting with newly evaluated entities

None

Returns:

Name Type Description
user_models dict[int, ScoringModel]

user_models[user] is the learned scoring model for user

user_learn

user_learn(user_judgments: dict[str, DataFrame], entities: DataFrame, initialization: Optional[ScoringModel] = None, new_judgments: Optional[dict[str, DataFrame]] = None) -> ScoringModel

Learns a scoring model, given user judgments of entities

Parameters:

Name Type Description Default
user_judgments dict[str, DataFrame]

May contain different forms of judgments, but most likely will contain "comparisons" and/or "assessments"

required
entities DataFrame
  • entity_id: int, index
  • May contain others, such as vector representation
required
initialization Optional[ScoringModel]

Starting model, added to facilitate optimization It is not supposed to affect the output of the training

None
new_judgments Optional[dict[str, DataFrame]]

New judgments This allows to prioritize coordinate descent, starting with newly evaluated entities

None

Returns:

Name Type Description
model ScoringModel

UniformGBT

UniformGBT(prior_std_dev: float = 7.0, convergence_error: float = 1e-05, cumulant_generating_function_error: float = 1e-05, high_likelihood_range_threshold: float = 1.0)

Bases: GeneralizedBradleyTerry

Parameters (TODO)

LBFGSUniformGBT

LBFGSUniformGBT(prior_std_dev: float = 7, convergence_error: float = 1e-05, cumulant_generating_function_error: float = 1e-05, max_iter: int = 100, high_likelihood_range_threshold: float = 1.0)

Bases: LBFGSGeneralizedBradleyTerry

Parameters (TODO)

cumulant_generating_function

cumulant_generating_function(score_diff: Tensor) -> Tensor

For.

Parameters:

Name Type Description Default
score_diff Tensor

Score difference

required

Returns:

Name Type Description
out float