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

27
LINES

< > BotCompany Repo | #1018822 // findBest_Audio_TwoWordAnalyzer1

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

Libraryless. Click here for Pure Java version (4525L/29K).

1  
static IterableIterator<Audio_TwoWordAnalyzer1> findBest_Audio_TwoWordAnalyzer1(final LPair<S, BWImage> images) {
2  
  replace A with Audio_TwoWordAnalyzer1.
3  
  final LS words = uniquify(pairsA(images));
4  
  final new Best<A> best;
5  
  final new AIStrategy_RandomWithVariation<A> strategy;
6  
  strategy.random = func -> A { random_Audio_TwoWordAnalyzer1(first(words), second(words)) };
7  
  // todo: variation
8  
  strategy.submit = func(final A a) -> double {
9  
    new Scorer scorer;
10  
    
11  
    for (Pair<S, BWImage> img : images)
12  
      scorer.add(eqic(img.a, a.analyze(img.b)));
13  
      
14  
    if (best.put(a, scorer!))
15  
      print(scorer + " / " + struct(a)); 
16  
    ret scorer!;
17  
  };
18  
  // rest of function should be same as: ret strategyIterator(best, strategy, optimumValue := 100.0);
19  
  ret iff(func {
20  
    if (best.score() == 100) ret endMarker();
21  
    A lastBest = best!;
22  
    strategy.go();
23  
    A a = best! == lastBest ? null : best!;
24  
    lastBest = best!;
25  
    ret a;
26  
  });
27  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1018822
Snippet name: findBest_Audio_TwoWordAnalyzer1
Eternal ID of this version: #1018822/7
Text MD5: 9f11442b7c849647f199d4d25ac365ac
Transpilation MD5: 073787aa4078017e83971de77f0d0368
Author: stefan
Category: javax / audio
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-24 19:38:50
Source code size: 981 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 267 / 347
Version history: 6 change(s)
Referenced in: [show references]