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)

static Scorer dm_gazelle_checkPredictor(F2<RuleEngine2_MatchedRule, Collection<S>, S> predictor, O... _) {
  ret dm_gazelle_checkPredictor(predictor, _);
}

static Scorer dm_gazelle_checkPredictor(O predictor, O... _) {
  bool verbose = boolPar verbose(_);
  S ruleID = stringPar ruleID(_);
  new Map<S, Set<S>> statementsByRule;
  new Scorer scorer;
  for (dm_gazelle_appliedRulesForLearning_Entry e : dm_gazelle_appliedRulesForLearning_withoutChangedRules()) {
    if (ruleID != null && neq(e.ruleID, ruleID)) continue;
    Set<S> statements = getOrCreateTreeSet(statementsByRule, e.ruleID);
    if (nempty(statements)) {
      if (verbose)
        print("Have " + n2(statements, "statement"));
      S guess = (S) callF(predictor, e.r, statements);
      scorer.add(eq(guess, e.judgement));
      if (verbose)
        print("  " + guess + "/" + e.judgement + ": " + e.r.map);
    }
  
    LS newStatements = ai_gazelle_statementsFromAppliedRule(e.r, e.judgement);
    statements.addAll(newStatements);
  }
  ret scorer;
}

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: 259 / 301
Version history: 6 change(s)
Referenced in: [show references]