test_class.file: modules/ml/src/test/java/org/apache/ignite/ml/selection/scoring/metric/classification/BinaryClassificationMetricsTest.java
test_class.identifier: BinaryClassificationMetricsTest
test_case.body: @Test
      public void testDefaultBehaviourForScoreAll() {
          BinaryClassificationMetrics scoreCalculator = new BinaryClassificationMetrics();
  
          LabelPairCursor<Double> cursor = new TestLabelPairCursor<>(
              Arrays.asList(1.0, 1.0, 1.0, 1.0),
              Arrays.asList(1.0, 1.0, 0.0, 1.0)
          );
  
          BinaryClassificationMetricValues metricValues = scoreCalculator.scoreAll(cursor.iterator());
  
          assertEquals(0.75, metricValues.accuracy(), 1e-12);
      }
test_case.class_method_signature: BinaryClassificationMetricsTest.testDefaultBehaviourForScoreAll()
test_case.full_signature: @Test public void testDefaultBehaviourForScoreAll()
test_case.identifier: testDefaultBehaviourForScoreAll
test_case.invocations: asList asList scoreAll iterator assertEquals accuracy
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testDefaultBehaviourForScoreAll()
focal_class.declarator: positiveClsLb = 1.0
focal_class.modifier: private
focal_class.original_string: private double positiveClsLb = 1.0;
focal_class.type: double
focal_class.var_name: positiveClsLb
focal_class.declarator: negativeClsLb
focal_class.modifier: private
focal_class.original_string: private double negativeClsLb;
focal_class.type: double
focal_class.var_name: negativeClsLb
focal_class.declarator: enableROCAUC
focal_class.modifier: private
focal_class.original_string: private boolean enableROCAUC;
focal_class.type: boolean
focal_class.var_name: enableROCAUC
focal_class.file: modules/ml/src/main/java/org/apache/ignite/ml/selection/scoring/metric/classification/BinaryClassificationMetrics.java
focal_class.identifier: BinaryClassificationMetrics
focal_class.class_method_signature: BinaryClassificationMetrics.scoreAll(Iterator<LabelPair<Double>> iter)
focal_class.full_signature: @Override public BinaryClassificationMetricValues scoreAll(Iterator<LabelPair<Double>> iter)
focal_class.identifier: scoreAll
focal_class.modifiers: @Override public
focal_class.parameters: (Iterator<LabelPair<Double>> iter)
focal_class.return: BinaryClassificationMetricValues
focal_class.signature: BinaryClassificationMetricValues scoreAll(Iterator<LabelPair<Double>> iter)
focal_class.class_method_signature: BinaryClassificationMetrics.positiveClsLb()
focal_class.full_signature: public double positiveClsLb()
focal_class.identifier: positiveClsLb
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: double
focal_class.signature: double positiveClsLb()
focal_class.class_method_signature: BinaryClassificationMetrics.withPositiveClsLb(double positiveClsLb)
focal_class.full_signature: public BinaryClassificationMetrics withPositiveClsLb(double positiveClsLb)
focal_class.identifier: withPositiveClsLb
focal_class.modifiers: public
focal_class.parameters: (double positiveClsLb)
focal_class.return: BinaryClassificationMetrics
focal_class.signature: BinaryClassificationMetrics withPositiveClsLb(double positiveClsLb)
focal_class.class_method_signature: BinaryClassificationMetrics.negativeClsLb()
focal_class.full_signature: public double negativeClsLb()
focal_class.identifier: negativeClsLb
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: double
focal_class.signature: double negativeClsLb()
focal_class.class_method_signature: BinaryClassificationMetrics.withNegativeClsLb(double negativeClsLb)
focal_class.full_signature: public BinaryClassificationMetrics withNegativeClsLb(double negativeClsLb)
focal_class.identifier: withNegativeClsLb
focal_class.modifiers: public
focal_class.parameters: (double negativeClsLb)
focal_class.return: BinaryClassificationMetrics
focal_class.signature: BinaryClassificationMetrics withNegativeClsLb(double negativeClsLb)
focal_class.class_method_signature: BinaryClassificationMetrics.withEnablingROCAUC(boolean enableROCAUC)
focal_class.full_signature: public BinaryClassificationMetrics withEnablingROCAUC(boolean enableROCAUC)
focal_class.identifier: withEnablingROCAUC
focal_class.modifiers: public
focal_class.parameters: (boolean enableROCAUC)
focal_class.return: BinaryClassificationMetrics
focal_class.signature: BinaryClassificationMetrics withEnablingROCAUC(boolean enableROCAUC)
focal_class.class_method_signature: BinaryClassificationMetrics.isROCAUCenabled()
focal_class.full_signature: public boolean isROCAUCenabled()
focal_class.identifier: isROCAUCenabled
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isROCAUCenabled()
focal_class.class_method_signature: BinaryClassificationMetrics.name()
focal_class.full_signature: @Override public String name()
focal_class.identifier: name
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String name()
focal_class.superclass: extends AbstractMetrics<BinaryClassificationMetricValues>
focal_method.body: @Override public BinaryClassificationMetricValues scoreAll(Iterator<LabelPair<Double>> iter) {
          long tp = 0;
          long tn = 0;
          long fp = 0;
          long fn = 0;
          double rocauc = Double.NaN;
  
          // for ROC AUC calculation
          long pos = 0;
          long neg = 0;
          PriorityQueue<Pair<Double, Double>> queue = new PriorityQueue<>(Comparator.comparingDouble(Pair::getKey));
  
          while (iter.hasNext()) {
              LabelPair<Double> e = iter.next();
  
              double prediction = e.getPrediction();
              double truth = e.getTruth();
  
              if (prediction != negativeClsLb && prediction != positiveClsLb)
                  throw new UnknownClassLabelException(prediction, positiveClsLb, negativeClsLb);
              if (truth != negativeClsLb && truth != positiveClsLb)
                  throw new UnknownClassLabelException(truth, positiveClsLb, negativeClsLb);
  
              if (truth == positiveClsLb && prediction == positiveClsLb) tp++;
              else if (truth == positiveClsLb && prediction == negativeClsLb) fn++;
              else if (truth == negativeClsLb && prediction == negativeClsLb) tn++;
              else if (truth == negativeClsLb && prediction == positiveClsLb) fp++;
  
              if (enableROCAUC) {
                  queue.add(new Pair<>(prediction, truth));
  
                  if (truth == positiveClsLb)
                      pos++;
                  else if (truth == negativeClsLb)
                      neg++;
                  else
                      throw new UnknownClassLabelException(truth, positiveClsLb, negativeClsLb);
              }
  
          }
  
          if (enableROCAUC)
              rocauc = ROCAUC.calculateROCAUC(queue, pos, neg, positiveClsLb);
  
          return new BinaryClassificationMetricValues(tp, tn, fp, fn, rocauc);
      }
focal_method.class_method_signature: BinaryClassificationMetrics.scoreAll(Iterator<LabelPair<Double>> iter)
focal_method.full_signature: @Override public BinaryClassificationMetricValues scoreAll(Iterator<LabelPair<Double>> iter)
focal_method.identifier: scoreAll
focal_method.invocations: comparingDouble hasNext next getPrediction getTruth add calculateROCAUC
focal_method.modifiers: @Override public
focal_method.parameters: (Iterator<LabelPair<Double>> iter)
focal_method.return: BinaryClassificationMetricValues
focal_method.signature: BinaryClassificationMetricValues scoreAll(Iterator<LabelPair<Double>> iter)