Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
34
Task/Ranking-methods/Zkl/ranking-methods-1.zkl
Normal file
34
Task/Ranking-methods/Zkl/ranking-methods-1.zkl
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
fcn group(scores){ // group like scores into one list --> list of lists
|
||||
sink:=List();
|
||||
scores.reduce('wrap(ps,sn,buf){
|
||||
if(sn[0]!=ps){ sink.append(buf.copy()); buf.clear(); }
|
||||
buf+sn;
|
||||
sn[0];
|
||||
},scores[0][0],buf:=List());
|
||||
sink.append(buf);
|
||||
}
|
||||
fcn print(list,rank){
|
||||
list.apply2('wrap(sn){ "%2s: %s (%d)".fmt(rank,sn[1],sn[0]):println(_); });
|
||||
}
|
||||
fcn rankViaStandard(scores){
|
||||
rank:=1;
|
||||
foreach group in (group(scores)){ print(group,rank); rank+=group.len(); }
|
||||
}
|
||||
fcn rankViaModified(scores){
|
||||
rank:=0;
|
||||
foreach group in (group(scores)){ rank+=group.len(); print(group,rank); }
|
||||
}
|
||||
fcn rankViaDense(scores){
|
||||
rank:=1;
|
||||
foreach group in (group(scores)){ print(group,rank); rank+=1; }
|
||||
}
|
||||
fcn rankViaOrdinal(scores){
|
||||
scores.apply2('wrap(sn,rr){ "%2s: %s (%d)".fmt(rr.inc(),sn[1],sn[0]):println(_); },Ref(1));
|
||||
}
|
||||
fcn rankViaFractional(scores){
|
||||
rank:=1;
|
||||
foreach group in (group(scores)){
|
||||
n:=group.len(); r:=rank.reduce(n,'+,0.0)/n; rank+=n;
|
||||
print(group,"%5.2f".fmt(r));
|
||||
}
|
||||
}
|
||||
8
Task/Ranking-methods/Zkl/ranking-methods-2.zkl
Normal file
8
Task/Ranking-methods/Zkl/ranking-methods-2.zkl
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// these are sorted!?!
|
||||
scores:=T(T(44,"Solomon"), T(42,"Jason"), T(42,"Errol"), T(41,"Garry"),
|
||||
T(41,"Bernard"),T(41,"Barry"),T(39,"Stephen"),);
|
||||
"Standard:" .println(); rankViaStandard(scores);
|
||||
"Modified:" .println(); rankViaModified(scores);
|
||||
"Dense:" .println(); rankViaDense(scores);
|
||||
"Ordinal:" .println(); rankViaOrdinal(scores);
|
||||
"Fractional:".println(); rankViaFractional(scores);
|
||||
Loading…
Add table
Add a link
Reference in a new issue