Voting rights
Step 2 in the pipeline
Voting rights are assigned per user and per entity, based on users' trust scores and privacy settings.
VotingRightsAssignment
¶
Bases: ABC
__call__
¶
__call__(
users: DataFrame,
entities: DataFrame,
vouches: DataFrame,
privacy: PrivacySettings,
) -> tuple[VotingRights, DataFrame]
Compute voting rights
Parameters:
Name | Type | Description | Default |
---|---|---|---|
users
|
DataFrame
|
|
required |
entities
|
DataFrame
|
|
required |
vouches
|
DataFrame
|
|
required |
privacy
|
PrivacySettings
|
privacy[user, entity] in { True, False, None } |
required |
Returns:
Name | Type | Description |
---|---|---|
voting_rights[user, entity] is the voting right
|
of a user on entity for criterion |
|
entities |
DataFrame with columns
|
|
IsTrust
¶
IsTrust(privacy_penalty: float = 0.5)
Bases: VotingRightsAssignment
Implements voting rights assignment directly based on user trust scores and applying some privacy penalty.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
privacy_penalty
|
float
|
Penalty on private comparisons. |
0.5
|
__call__
¶
__call__(
users: DataFrame,
entities: DataFrame,
vouches: DataFrame,
privacy: DataFrame,
) -> tuple[VotingRights, DataFrame]
Compute voting rights
Parameters:
Name | Type | Description | Default |
---|---|---|---|
users
|
DataFrame
|
|
required |
entities
|
DataFrame
|
|
required |
vouches
|
DataFrame
|
|
required |
privacy
|
DataFrame
|
privacy[user, entity] in { True, False, None } |
required |
Returns:
Name | Type | Description |
---|---|---|
voting_rights[user, entity] is the voting right
|
of a user on entity for criterion |
|
entities |
DataFrame with columns
|
|
AffineOvertrust
¶
AffineOvertrust(
privacy_penalty: float = 0.5,
min_overtrust: float = 2.0,
overtrust_ratio: float = 0.1,
)
Bases: VotingRightsAssignment
Initializes the AffineOvertrust model with the specified parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
privacy_penalty
|
float
|
Penalty on private comparisons. |
0.5
|
min_overtrust
|
float
|
Minimum overtrust amount to distribute over all users. |
2.0
|
overtrust_ratio
|
float
|
Trust ratio used to compute maximal allowed overtrust. |
0.1
|
__call__
¶
__call__(
users: DataFrame,
entities: DataFrame,
vouches: DataFrame,
privacy: PrivacySettings,
) -> tuple[VotingRights, DataFrame]
Compute voting rights for users on entities
Parameters:
Name | Type | Description | Default |
---|---|---|---|
users
|
DataFrame
|
|
required |
entities
|
DataFrame
|
|
required |
vouches
|
DataFrame
|
This is not used by VotingRightsWithLimitedOvertrust |
required |
privacy
|
PrivacySettings
|
privacy[user, entity] is the privacy setting of user for entity May be True, False or None |
required |
Returns:
Name | Type | Description |
---|---|---|
voting_rights[user, entity] is the voting right
|
of a user on entity for criterion |
|
entities |
DataFrame with columns
|
|
compute_entity_voting_rights
¶
compute_entity_voting_rights(
trust_scores: Series, privacy_weights: Series
) -> tuple[Series, float, float, float]
cumulative_trust
¶
cumulative_trust(
trust_scores: ndarray, privacy_weights: ndarray
) -> float
Returns the sum of trusts of raters of entity entity_id, weighted by their privacy setting.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trust_scores
|
ndarray
|
|
required |
privacy_weights
|
ndarray
|
privacy_weights[u] is the privacy weight of user u |
required |
Returns:
Name | Type | Description |
---|---|---|
out |
float
|
|
maximal_overtrust
¶
overtrust
¶
Returns the overtrust, if min_voting_right is enforced upon all raters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
min_voting_right
|
float
|
Overtrust for min_voting_right |
required |
trust_scores
|
ndarray
|
values: trust_score (float) |
required |
privacy_weights
|
ndarray
|
values: privacy weight of user |
required |
Returns:
Name | Type | Description |
---|---|---|
out |
float
|
|
min_voting_right
¶
Returns the minimal voting rights that corresponds to max_overtrust.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
max_overtrust
|
float
|
Maximal overtrust allowed for entity_id |
required |
trust_scores
|
ndarray
|
trust score values per user |
required |
privacy_weights
|
ndarray
|
privacy weight per user |
required |
Returns:
Name | Type | Description |
---|---|---|
out |
float
|
|