Display cred explorer scores as -Log(score) (#535)

@wchargin suggested displaying scores this way. This way, lowest scores
are best, and higher scores are worse. This is a little
counterintuitive, but maybe less counterintuitive than the current
approach, which arbitrarily adds 10 to scores to keep them non-negative,
and results in an arbitrary crossing point where scores become negative
without any particular significance.

Test plan: Travis, and manual inspection of the frontend.
This commit is contained in:
Dandelion Mané 2018-07-27 17:04:29 -07:00 committed by GitHub
parent 873eca6350
commit 49da7cfdb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View File

@ -67,8 +67,7 @@ function edgeVerb(
}
function scoreDisplay(probability: number) {
const modifiedLogScore = Math.log(probability) + 10;
return modifiedLogScore.toFixed(2);
return (-1 * Math.log(probability)).toFixed(2);
}
type SharedProps = {|

View File

@ -378,7 +378,7 @@ describe("app/credExplorer/PagerankTable", () => {
it("renders a score column with the node's log-score", async () => {
const {element, sharedProps, node} = await setup();
const {score: rawScore} = NullUtil.get(sharedProps.pnd.get(node));
const expectedScore = (Math.log(rawScore) + 10).toFixed(2);
const expectedScore = (-Math.log(rawScore)).toFixed(2);
const contributionColumn = COLUMNS().indexOf("Score");
expect(contributionColumn).not.toEqual(-1);
expect(
@ -528,9 +528,7 @@ describe("app/credExplorer/PagerankTable", () => {
});
it("renders a score column with the source's log-score", async () => {
const {element, contribution} = await setup();
const expectedScore = (Math.log(contribution.sourceScore) + 10).toFixed(
2
);
const expectedScore = (-Math.log(contribution.sourceScore)).toFixed(2);
const contributionColumn = COLUMNS().indexOf("Score");
expect(contributionColumn).not.toEqual(-1);
expect(