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

9
LINES

< > BotCompany Repo | #1030117 // findThreshold_unmoved - just average between max of l1 and max of l2

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2654L/16K).

// find best threshold value to separate list1 (smaller values) from list2 (bigger values), minimizing false positives + false negatives
// returns (threshold, false positives, false negatives)
static T3<Double, Int, Int> findThreshold_unmoved(Cl<Double> list1, Cl<Double> list2) {
  if (empty(list1) || empty(list2)) null;
  double threshold = avg(doubleMax(list1), doubleMin(list2));
  int falsePositives = countPred(list1, d -> d > threshold);
  int falseNegatives = countPred(list2, d -> d <= threshold);
  ret t3(threshold, falsePositives, falseNegatives);
}

Author comment

Began life as a copy of #1030114

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030117
Snippet name: findThreshold_unmoved - just average between max of l1 and max of l2
Eternal ID of this version: #1030117/1
Text MD5: 5c731b50094d11faf668fccdf08517ea
Transpilation MD5: 3b2ae53ab611e2c750172a99f2228a8b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-11-09 14:03:12
Source code size: 571 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 239 / 322
Referenced in: [show references]