Cred Analysis Notebooks

Reading through the code and notebooks attempting to understand what’s going on. Since I always take notes, might as well keep track of them here in case that’s useful for anyone.

Payout Notebooks

Starting with these because they’re the most updated notebooks that the SourceCred community seems to have. Looks like the way the notebooks work is that someone runs the SoruceCred protocol over SourceCred’s GitHub (is it just the sourcecred repo, or all the repos?) and Discourse. Then that someone (currently @decentralion) updates the Cred repo with that week’s weights and scores. Then that data is put into an Observable notebook (like this one) by linking to the scores_file and the distribution_history_file.

So the notebooks in the SourceCred Contributor Payouts thread only compute the Grain payouts based on the Cred scores. If we wanted to create notebooks to calculate how Cred might fluctuate with the introduction of various mechanisms we would need an entirely different system because we would be modeling the Cred itself, not the Grain that is a result of the Cred.


Cred Repo

In the Cred repo weights file it looks like there’s some things that have been manually bumped 4X:

   "nodeManualWeights": {
      "N\u0000sourcecred\u0000discourse\u0000topic\u0000https://discourse.sourcecred.io\u0000248\u0000": 8,
      "N\u0000sourcecred\u0000discourse\u0000topic\u0000https://discourse.sourcecred.io\u0000269\u0000": 4,
      "N\u0000sourcecred\u0000discourse\u0000topic\u0000https://discourse.sourcecred.io\u0000270\u0000": 4,
      "N\u0000sourcecred\u0000discourse\u0000topic\u0000https://discourse.sourcecred.io\u0000291\u0000": 4,
      "N\u0000sourcecred\u0000discourse\u0000topic\u0000https://discourse.sourcecred.io\u0000327\u0000": 4
    },

According to this Issue and this commit these correlate to:

  • Produce the SourceCred Podcast: Shipped the podcast!
  • Discourse Reference Detection: Recently completed.
  • Champions & Heroes: An exciting contribution. :slight_smile:
  • Initiatives Plugin: Nice progress so far.
  • Community call notes

Would be great if we had code comments here to explain that, but JSON does not allow for comments right?


How is Cred computed?

A little confused because Cred is computed in the main SourceCred repo in the weightEvaluator file (so that you can download it and run it on arbitrary repos and forums), and it’s also computed in plugins like Initiatives (so that plugins define their own logic), and Cred is computed in the Cred repo (not sure why there’s weights here and in the main repo). Why is Cred computed in so many places, or am I just misinterpreting the codebase?


How does Cred flow?

Reading through pagerankGraph.js:

 * Every edge in the Graph is assigned an `EdgeWeight`, which includes a
 * `forwards` (weight from the `src` to the `dst`) and a `backwards`
 * (weight from the `dst` back to the `src`). Both `forwards` and
 * `backwards` must be nonnegative numbers. The weights influence how
 * score flows from node to node. For example, if the node `root` is
 * connected to `a` with a weight of `1` and to `b` with a weight of `2`,
 * then `b` will recieve twice as much score from `root` as `a` does.

Discussing how exactly this works in the Questions About Initiatives - #8 by burrrata thread. Will update this thread with answers once I understand how exactly the connections between nodes works.

Also from pagerankGraph.js it looks like SourceCred creates a graph, then runs a (modified?) PageRank algorithm to score the graph, then all the SourceCred specific processing happens afterwards to boost or modify those scores?

 * At present, PagerankGraph does not support any modification to the
 * underlying Graph; doing so will invalidate PagerankGraph and cause
 * its methods to throw errors.
 */