Comment routing semi randomness #980
-
The comment routing used in polis is based on the deterministical weights. In a further step a comment is then chosen by those weights (https://compdemocracy.org/comment-routing/ and https://compdemocracy.org/semi-randomly/) . What is the technique used for getting the comment based of the weights? Is is just simply weighted randomness or is there anything applied to the weights, e.g. a softmax function? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
The answer to this question is here: https://compdemocracy.org/Representative-Comments/ As this is a specific question, I'm going to close the discussion as answered, but would consider a more specific discussion topic. I'll update the pages to link to this one. |
Beta Was this translation helpful? Give feedback.
-
Thanks for asking @LawrenceFulton. In short, we sum up all the weights, pick a random number between 0 and said sum, and then iterate through the comments, summing up all the past weights as we go, and pick the first one that surpasses the randomly selected value (the exact order of operations is slightly different due to performance optimization, but this gives you this gist easily enough). You can see the code that does this here: Lines 7134 to 7158 in 20ab1b3 Please let us know if you have any questions. Thanks! |
Beta Was this translation helpful? Give feedback.
Thanks for asking @LawrenceFulton.
In short, we sum up all the weights, pick a random number between 0 and said sum, and then iterate through the comments, summing up all the past weights as we go, and pick the first one that surpasses the randomly selected value (the exact order of operations is slightly different due to performance optimization, but this gives you this gist easily enough). You can see the code that does this here:
polis/server/src/server.js
Lines 7134 to 7158 in 20ab1b3