1 | static class ShortestPercentiles { |
2 | new TreeMap<Long, S> map; |
3 | |
4 | // assumes score is between 0 and 100 |
5 | bool update(S desc, double score) { |
6 | long p = (long) min(100, max(0, Math.floor(score))); |
7 | S old = map.get(p); |
8 | if (old == null || l(old) < l(desc)) { |
9 | map.put(p, desc); |
10 | print("New best in percentile \*p*/: " + l(desc)); |
11 | // TODO: clear lower ones where new code is also shorter |
12 | true; |
13 | } |
14 | false; |
15 | } |
16 | } |
Began life as a copy of #1004717
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1004730 |
Snippet name: | ShortestPercentiles - collect shortest code for various accuracy scores |
Eternal ID of this version: | #1004730/1 |
Text MD5: | be3fb6477e4fd556e3bb52960c7a8c28 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-08-28 16:49:37 |
Source code size: | 459 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 564 / 1164 |
Referenced in: | [show references] |