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

26
LINES

< > BotCompany Repo | #1021455 // dm_gazelle_checkPredictor - check custom predictor on all rules

JavaX fragment (include)

1  
static Scorer dm_gazelle_checkPredictor(F2<RuleEngine2_MatchedRule, Collection<S>, S> predictor, O... _) {
2  
  ret dm_gazelle_checkPredictor(predictor, _);
3  
}
4  
5  
static Scorer dm_gazelle_checkPredictor(O predictor, O... _) {
6  
  bool verbose = boolPar verbose(_);
7  
  S ruleID = stringPar ruleID(_);
8  
  new Map<S, Set<S>> statementsByRule;
9  
  new Scorer scorer;
10  
  for (dm_gazelle_appliedRulesForLearning_Entry e : dm_gazelle_appliedRulesForLearning_withoutChangedRules()) {
11  
    if (ruleID != null && neq(e.ruleID, ruleID)) continue;
12  
    Set<S> statements = getOrCreateTreeSet(statementsByRule, e.ruleID);
13  
    if (nempty(statements)) {
14  
      if (verbose)
15  
        print("Have " + n2(statements, "statement"));
16  
      S guess = (S) callF(predictor, e.r, statements);
17  
      scorer.add(eq(guess, e.judgement));
18  
      if (verbose)
19  
        print("  " + guess + "/" + e.judgement + ": " + e.r.map);
20  
    }
21  
  
22  
    LS newStatements = ai_gazelle_statementsFromAppliedRule(e.r, e.judgement);
23  
    statements.addAll(newStatements);
24  
  }
25  
  ret scorer;
26  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, whxojlpjdney

No comments. add comment

Snippet ID: #1021455
Snippet name: dm_gazelle_checkPredictor - check custom predictor on all rules
Eternal ID of this version: #1021455/7
Text MD5: b295a7e6f54fc07754d67e065735af1e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-02 18:18:12
Source code size: 1049 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 261 / 303
Version history: 6 change(s)
Referenced in: [show references]