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

16
LINES

< > BotCompany Repo | #1027850 // test_AutoClassifier1 (OK!)

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

Libraryless. Click here for Pure Java version (7134L/46K).

svoid test_AutoClassifier1() {
  int n = 4; // number of examples to learn for - 4 actually work
  AutoClassifier1<S> c = AutoClassifier1.queueLess(S);

  // no labels in empty classifier
  classifier_testLabels(c, litorderedmap("hello", ll()));
  
  // train
  c.learn(takeFirst((n+1)/2, ll("hello", "abcde", "xxxxx")), "5 chars");
  c.learn(takeFirst(n/2, ll("bla", "abcd", "aa")), "not 5 chars");
  
  // test
  classifier_testLabels(c, litorderedmap(
    "world", ll("5 chars"),
    "......", ll("not 5 chars")));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027850
Snippet name: test_AutoClassifier1 (OK!)
Eternal ID of this version: #1027850/17
Text MD5: d2af94f31a895eae5b86961c5c26086f
Transpilation MD5: 39b78ce606ba6973baed528582a0dcd3
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-05-14 15:04:10
Source code size: 534 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 240 / 447
Version history: 16 change(s)
Referenced in: [show references]