Skip to content

Inverted steps 2 and 3 of the Solidago pipeline#2043

Merged
amatissart merged 5 commits intomainfrom
solidago_invert_steps_2_and_3
Mar 6, 2025
Merged

Inverted steps 2 and 3 of the Solidago pipeline#2043
amatissart merged 5 commits intomainfrom
solidago_invert_steps_2_and_3

Conversation

@lenhoanglnh
Copy link
Contributor

A step towards Liquid Democracy #2042


Description

Steps 2 (voting rights assignment) and 3 (individual preference learning) of Solidago were so far independent, and thus commutative.
Here, we invert them (thereby not affecting correctness), and we add the possibility of voting rights assignment to depend on learned individual preferences.
This is important as a user may typically want to delegate their voting rights on an entity, if the uncertainty on their score for this entity is too large.

Checklist

  • I added the related issue(s) id in the related issues section (if any)
  • I described my changes and my decisions in the PR description
  • I read the development guidelines of the CONTRIBUTING.md
  • The tests pass and have been updated if relevant
  • The code quality check pass

❤️ Thank you for your contribution!

@lenhoanglnh lenhoanglnh added the Solidago Tournesol algorithms library label Dec 20, 2024
Copy link
Member

@amatissart amatissart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, with minor comments.

I would also bump the package version from v0.3.1 to v0.4.0 in solidago/src/solidago/__version__.py, as the change in the pipeline arguments can be considered as a breaking change.

Comment on lines 78 to 80
self,
trust_propagation: TrustPropagation = DefaultPipeline.trust_propagation,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can make sure no client unexpectedly relies on the order of the arguments by requiring named arguments here:

Suggested change
self,
trust_propagation: TrustPropagation = DefaultPipeline.trust_propagation,
self,
*,
trust_propagation: TrustPropagation = DefaultPipeline.trust_propagation,

Comment on lines +195 to +197
logger.info(f"Pipeline 3. Computing voting rights with {str(self.voting_rights)}")
# WARNING: `privacy` may contain (user, entity) even if user has expressed no judgement
# about the entity. These users should not be given a voting right on the entity.
# For now, irrelevant privacy values are excluded in `input.get_pipeline_kwargs()`
voting_rights, entities = self.voting_rights(users, entities, vouches, privacy)
start_step3 = timeit.default_timer()
logger.info(f"Pipeline 2. Terminated in {np.round(start_step3 - start_step2, 2)} seconds")

logger.info(f"Pipeline 3. Learning preferences with {str(self.preference_learning)}")
user_models = self.preference_learning(judgments, users, entities, init_user_models)
voting_rights, entities = self.voting_rights(users, entities, vouches, privacy, user_models)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR could be an opportunity to solve this warning for good: maybe we could specify that any VotingRightsAssignment implementation should ensure that no voting right is assigned to a (user, entity) that has no score in user_models?

@amatissart
Copy link
Member

@lenhoanglnh Should we proceed with merging this PR? My comments can addressed separately.

@amatissart amatissart force-pushed the solidago_invert_steps_2_and_3 branch from 5a5b962 to 118f875 Compare March 6, 2025 11:00
@amatissart amatissart merged commit c5d62c0 into main Mar 6, 2025
10 checks passed
@amatissart amatissart deleted the solidago_invert_steps_2_and_3 branch March 6, 2025 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Solidago Tournesol algorithms library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants