void updateRanked() { if (choiceRank < rankings.size()) { ranking.setText((choiceRank + 1) + "/" + rankings.size()); Move choice = rankings.get(choiceRank).getFirst(); int node = rankings.get(choiceRank).getSecond(); boolean matches = choice == currentMove(); label.setTextFill(matches ? Color.GREEN : Color.RED); label.setText(choice.toString()); placeOnCanvas(learner.getIdealInputFor(choice, node), clusterView); if (!matches) { pause(); } } }
@FXML void train() { try { learner = learners.newInstanceOf(algorithm.getSelectionModel().getSelectedItem()); BlockingQueue<Duple<Move, AdaptedYUYVImage>> imgs = new ArrayBlockingQueue<>(1); startProducerThread(trainingSet.getSelectionModel().getSelectedItem(), imgs); label.setTextFill(Color.BLACK); label.setText("0"); startConsumerThread( imgs, mImg -> { Platform.runLater( () -> { label.setText(Integer.toString(Integer.parseInt(label.getText()) + 1)); learner.train(mImg.getSecond(), mImg.getFirst()); }); }); } catch (InstantiationException e) { reportProblem(e); } catch (IllegalAccessException e) { reportProblem(e); } }
void initRankings() { choiceRank = 0; rankings = learner.totalNodeRankingFor(currentFrame()); }