test_class.file: modules/ml/src/test/java/org/apache/ignite/ml/selection/scoring/metric/regression/RegressionMetricsTest.java
test_class.identifier: RegressionMetricsTest
test_case.body: @Test
      public void testDefaultBehaviourForScoreAll() {
          RegressionMetrics scoreCalculator = new RegressionMetrics();
  
          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)
          );
  
          RegressionMetricValues metricValues = scoreCalculator.scoreAll(cursor.iterator());
  
          assertEquals(1.0, metricValues.rss(), 1e-12);
      }
test_case.class_method_signature: RegressionMetricsTest.testDefaultBehaviourForScoreAll()
test_case.full_signature: @Test public void testDefaultBehaviourForScoreAll()
test_case.identifier: testDefaultBehaviourForScoreAll
test_case.invocations: asList asList scoreAll iterator assertEquals rss
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testDefaultBehaviourForScoreAll()
focal_class.declarator: EPS = 0.00001
focal_class.modifier: private static final
focal_class.original_string: private static final double EPS = 0.00001;
focal_class.type: double
focal_class.var_name: EPS
focal_class.file: modules/ml/src/main/java/org/apache/ignite/ml/selection/scoring/metric/regression/RegressionMetrics.java
focal_class.identifier: RegressionMetrics
focal_class.class_method_signature: RegressionMetrics.scoreAll(Iterator<LabelPair<Double>> iter)
focal_class.full_signature: @Override public RegressionMetricValues scoreAll(Iterator<LabelPair<Double>> iter)
focal_class.identifier: scoreAll
focal_class.modifiers: @Override public
focal_class.parameters: (Iterator<LabelPair<Double>> iter)
focal_class.return: RegressionMetricValues
focal_class.signature: RegressionMetricValues scoreAll(Iterator<LabelPair<Double>> iter)
focal_class.class_method_signature: RegressionMetrics.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<RegressionMetricValues>
focal_method.body: @Override public RegressionMetricValues scoreAll(Iterator<LabelPair<Double>> iter) {
          int totalAmount = 0;
          double rss = 0.0;
          double mae = 0.0;
  
          double sumOfLbls = 0.0;
          double sumOfSquaredLbls = 0.0;
  
          while (iter.hasNext()) {
              LabelPair<Double> e = iter.next();
  
              double prediction = e.getPrediction();
              double truth = e.getTruth();
  
              rss += Math.pow(prediction - truth, 2.0);
              mae += Math.abs(prediction - truth);
  
              totalAmount++;
              sumOfLbls += truth;
              sumOfSquaredLbls += Math.pow(truth, 2);
          }
  
          double meanOfLbls = sumOfLbls / totalAmount;
          double meanOfLblSquares = sumOfSquaredLbls / totalAmount;
          double tss = totalAmount * (meanOfLblSquares - Math.pow(meanOfLbls, 2));
  
          double r2 = 0.0;
          if (Math.abs(tss) < EPS) r2 = Math.abs(rss) < EPS ? 1.0 : 0.0;
          else r2 = 1 - rss / tss;
  
          mae /= totalAmount;
  
          return new RegressionMetricValues(totalAmount, rss, mae, r2);
      }
focal_method.class_method_signature: RegressionMetrics.scoreAll(Iterator<LabelPair<Double>> iter)
focal_method.full_signature: @Override public RegressionMetricValues scoreAll(Iterator<LabelPair<Double>> iter)
focal_method.identifier: scoreAll
focal_method.invocations: hasNext next getPrediction getTruth pow abs pow pow abs abs
focal_method.modifiers: @Override public
focal_method.parameters: (Iterator<LabelPair<Double>> iter)
focal_method.return: RegressionMetricValues
focal_method.signature: RegressionMetricValues scoreAll(Iterator<LabelPair<Double>> iter)