-
Notifications
You must be signed in to change notification settings - Fork 10
Consensus Under Deadline #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Consensus Under Deadline algorithm in pure python, followed by the following article: https://arxiv.org/abs/1905.07173 |
|
@the-maldridge hi Michael! |
|
I appreciate the deadlines you are under, but be aware that the open source world moves on a timeline completely divorced from that of academia. I will get to this PR as I have time. Please do not close it and open a new one, git has mechanisms for pushing state changes when conflicts exist. |
| @@ -0,0 +1,394 @@ | |||
| import doctest | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file should start with a title containing the article name and link, author names, programmer name, and date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't match the style of any of the other files. I will accept a header linking the arxiv papger, but the other information is to be dropped. You may add relevant names to the contributors file at the root of the repo.
| @@ -0,0 +1,127 @@ | |||
| from py3votecore.consensus_under_deadline import ConsensusUnderDeadline, mdvr | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file should start with a title containing the article name and link, author names, programmer name, and date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As with the other file, no it shouldn't. This should match the style of other files in the repo (i.e. GPL header), or I will accpet a very short header that includes the link to the Arxiv reference document.
| from collections import Counter | ||
|
|
||
|
|
||
| logging.basicConfig(level=logging.DEBUG) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Global logging configuration should not be set in a unit - only in the main program
the-maldridge
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of small issues. Also you will eventually need to perform a rebase and squash to make your PR one functional change without all the intermediate steps. See individual comments for each item.
| @@ -0,0 +1,394 @@ | |||
| import doctest | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't match the style of any of the other files. I will accept a header linking the arxiv papger, but the other information is to be dropped. You may add relevant names to the contributors file at the root of the repo.
| Returns: | ||
| The winner alternative | ||
|
|
||
| ---------------------------------TESTS--------------------------------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As near as I can tell the mdvr function is dead code that exists solely to make these tests work. If you want to write an example, it should go into the class docstring. If you want to write an integration test, it should go into an integration test that's part of a different component.
| The model was presented by Marina Bannikova, Lihi Dery, Svetlana Obraztsova, Zinovi Rabinovich, Jeffrey S. Rosenschein (2019), | ||
| https://arxiv.org/abs/1905.07173 | ||
|
|
||
| Author: Raphael Suliman |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Migrate authorship information to the CONTRIBUTORS file at the root of the repo.
|
|
||
| class ConsensusUnderDeadline(): | ||
| ''' | ||
| A class representing a model for group decision making under strict deadline, based on iterative process. Each alternative must be accept |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line wrapping here looks funky. You probably need to reflow this block comment to bring it into the expected line width I see you have used elsewhere in the file.
| remaining_rounds - a threshold for the amount if rounds left until decision should be taken | ||
| random_selection - whether the selection of voter for changing their ballot. If False - the smallest voter's number will be selected | ||
| ''' | ||
| logger.info('ConsensusUnderDeadline object created') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be at debug, possibly even trace priority, definitely not info.
| >>> print(cud.deploy_algorithm()) | ||
| null | ||
| ''' | ||
| logger.info('deploying algorithm') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, debug priority at most, this log line probably shouldn't even happen.
| ''' | ||
| Lower round by one - symbolize a passing iteration. | ||
|
|
||
| ---------------------------------TESTS--------------------------------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this in a block comment? This shouldn't be here.
| Returns: | ||
| List of alternatives with a chance to win | ||
|
|
||
| ---------------------------------TESTS--------------------------------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This really looks like you're embedding what should have been automated integration tests into the docstrings. doctests is meant to ensure that your examples work, not to serve as your general purpose test framework.
| @@ -0,0 +1,127 @@ | |||
| from py3votecore.consensus_under_deadline import ConsensusUnderDeadline, mdvr | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As with the other file, no it shouldn't. This should match the style of other files in the repo (i.e. GPL header), or I will accpet a very short header that includes the link to the Arxiv reference document.
| self.assertEqual(mdvr(voters=v, voters_type = v_type, alternatives=alters, default_alternative=df_alter,voters_preferences=[['a', 'b', 'c', 'd'], ['a', 'c', 'b', 'd'], ['a', 'c', 'b', 'd'], ['a', 'b', 'c', 'd'], ['a', 'b', 'd', 'c']], remaining_rounds=t, random_selection=False), 'a') # test case with unanimously on the start | ||
|
|
||
| if __name__ == '__main__': | ||
| unittest.main() No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing final newline. This is usually a configuration problem with your editor.
|
Also note that at this time I have not yet reviewed the conformance of the implemented algorithm against the workflow discussed in the linked reference material. I made a first pass review of the code, and I will make an additional review pass for the actual results of the algorithm. |
No description provided.