Ranking methods: Difference between revisions

m
Line 801:
ns = [44, 42, 42, 41, 41, 41, 39],
 
sorted = xs.map(function (xa, ib) {
return { name: xa, score: ns[ib] };
}).sort(function (a, b) {
var dc = b.score - a.score;
return c ? c : a.name < b.name ? -1 : a.name > b.name ? 1 : 0;
return d ? d : (
a.name < b.name ? -1 : (
a.name > b.name ? 1 : 0
)
)
}),
 
names = sorted.map(function (x) { return x.name; }),
scores = sorted.map(function (x) { return x.score; }),
Line 823 ⟶ 818:
 
// RANKINGS AS FUNCTIONS OF SCORES: SORTED, REVERSED AND UNIQUE
 
var standard = function (score) {
return scores.indexOf(score) + 1;
},
 
modified = function (score) {
return reversed.length - reversed.indexOf(score);
},
 
dense = function (score) {
return unique.indexOf(score) + 1;
},
 
fractional = function (score) {
return (
Line 847 ⟶ 842:
name: names[index],
score: score,
 
Standard: standard(score),
Modified: modified(score),
Line 859 ⟶ 854:
'Name Score Standard Modified Dense Ordinal Fractional'.split(' ')
].concat(scores.map(rankings).reduce(function (a, x) {
return a.concat([[x.name, x.score,
[x.Standardname, x.Modifiedscore, x.Dense, x.Ordinal, x.Fractional
x.Standard, x.Modified, x.Dense, x.Ordinal, x.Fractional
]]);
return d ? d : ( ]
]);
}, [])),
 
9,659

edits