Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

12
LINES

< > BotCompany Repo | #1011034 // scoreGuesserIC_1_returnErrors - score a guess function for strings (ignore case); returns 0 to 1 and errors

JavaX fragment (include)

1  
static Pair<Double, SS> scoreGuesserIC_1_returnErrors(O guesser, SS examples) {
2  
  int ok = 0, total = 0;
3  
  SS errors = litorderedmap();
4  
  for (S key, value : examples) {
5  
    total++;
6  
    S s = unnullStr(pcallF(guesser, key));
7  
    if (eqic(value, s)) ok++;
8  
    else errors.put(key, s);
9  
    
10  
  }
11  
  ret pair(total == 0 ? 1 : ok/(double) total, errors);
12  
}

Author comment

Began life as a copy of #1011022

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: #1011034
Snippet name: scoreGuesserIC_1_returnErrors - score a guess function for strings (ignore case); returns 0 to 1 and errors
Eternal ID of this version: #1011034/4
Text MD5: c90dbc5da9695e551fe1ad3f6b7fe316
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-11 21:33:45
Source code size: 362 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 349 / 404
Version history: 3 change(s)
Referenced in: [show references]