Skip to content

Aggregation

Step 5 of the pipeline.

Aggregation combines the different user models to construct a global model. The aggregation may also adjust the user models to the learned global model.

Aggregation

__call__

__call__(
    voting_rights: VotingRights,
    user_models: Mapping[int, ScoringModel],
    users: DataFrame,
    entities: DataFrame,
) -> tuple[dict[int, ScoringModel], ScoringModel]

Returns scaled user models

Parameters:

Name Type Description Default
voting_rights VotingRights

voting_rights[user, entity]: float

required
user_models Mapping[int, ScoringModel]

user_models[user] is user's scoring model

required
users DataFrame
  • user_id (int, index)
  • trust_score (float)
required
entities DataFrame
  • entity_id (int, ind)
required

Returns:

Name Type Description
updated_user_models[user]: ScoringModel

Returns a scaled user model

global_model ScoringModel

Returns a global scoring model

Average

Bases: Aggregation

__call__

__call__(
    voting_rights: VotingRights,
    user_models: dict[int, ScoringModel],
    users: DataFrame,
    entities: DataFrame,
) -> tuple[dict[int, ScoringModel], ScoringModel]

Returns scaled user models

Parameters:

Name Type Description Default
voting_rights VotingRights

voting_rights[user, entity]: float

required
user_models dict[int, ScoringModel]

user_models[user] is user's scoring model

required
users DataFrame
  • user_id (int, index)
  • trust_score (float)
required
entities DataFrame
  • entity_id (int, ind)
required

Returns:

Name Type Description
updated_user_models[user]: ScoringModel

Returns a scaled user model

global_model ScoringModel

Returns a global scoring model

EntitywiseQrQuantile

EntitywiseQrQuantile(
    quantile=0.2, lipschitz=0.1, error=1e-05
)

Bases: Aggregation

Aggregates the scores per entity with qr_quantile.

Parameters:

Name Type Description Default
quantile
0.2
lipschitz
0.1
error
1e-05

__call__

__call__(
    voting_rights: VotingRights,
    user_models: dict[int, ScoringModel],
    users: DataFrame,
    entities: DataFrame,
) -> tuple[dict[int, ScoringModel], ScoringModel]

Returns scaled user models

Parameters:

Name Type Description Default
voting_rights VotingRights

voting_rights[user, entity]: float

required
user_models dict[int, ScoringModel]

user_models[user] is user's scoring model

required
users DataFrame
  • user_id (int, index)
  • trust_score (float)
required
entities DataFrame
  • entity_id (int, ind)
required

Returns:

Name Type Description
updated_user_models[user]: ScoringModel

Returns a scaled user model

global_model ScoringModel

Returns a global scoring model

StandardizedQrQuantile

StandardizedQrQuantile(
    quantile=0.2,
    dev_quantile=0.9,
    lipschitz=0.1,
    error=1e-05,
)

Bases: Aggregation

Standardize scores so that only a fraction 1 - dev_quantile of the scores is further than 1 away from the requested quantile, and then run qr_quantile to aggregate the scores.

Parameters:

Name Type Description Default
quantile
0.2
dev_quantile
0.9
lipschitz
0.1
error
1e-05

__call__

__call__(
    voting_rights: VotingRights,
    user_models: dict[int, ScoringModel],
    users: DataFrame,
    entities: DataFrame,
) -> tuple[dict[int, ScaledScoringModel], ScoringModel]

Returns scaled user models

Parameters:

Name Type Description Default
voting_rights VotingRights

voting_rights[user, entity]: float

required
user_models dict[int, ScoringModel]

user_models[user] is user's scoring model

required
users DataFrame
  • user_id (int, index)
  • trust_score (float)
required
entities DataFrame
  • entity_id (int, ind)
required

Returns:

Name Type Description
updated_user_models[user]: ScoringModel

Returns a scaled user model

global_model ScoringModel

Returns a global scoring model