test_class.file: modules/ml/src/test/java/org/apache/ignite/ml/tree/impurity/util/SimpleStepFunctionCompressorTest.java
test_class.identifier: SimpleStepFunctionCompressorTest
test_case.body: @Test
      public void testCompressDecreasingFunction() {
          StepFunction<TestImpurityMeasure> function = new StepFunction<>(
              new double[]{1, 2, 3, 4, 5},
              TestImpurityMeasure.asTestImpurityMeasures(5, 4, 3, 2, 1)
          );
  
          SimpleStepFunctionCompressor<TestImpurityMeasure> compressor = new SimpleStepFunctionCompressor<>(1, 0, 0.4);
  
          StepFunction<TestImpurityMeasure> resFunction = compressor.compress(function);
  
          assertArrayEquals(new double[]{1, 3, 5}, resFunction.getX(), 1e-10);
          assertArrayEquals(TestImpurityMeasure.asTestImpurityMeasures(5, 3, 1), resFunction.getY());
      }
test_case.class_method_signature: SimpleStepFunctionCompressorTest.testCompressDecreasingFunction()
test_case.full_signature: @Test public void testCompressDecreasingFunction()
test_case.identifier: testCompressDecreasingFunction
test_case.invocations: asTestImpurityMeasures compress assertArrayEquals getX assertArrayEquals asTestImpurityMeasures getY
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCompressDecreasingFunction()
focal_class.declarator: serialVersionUID = -3231787633598409157L
focal_class.modifier: private static final
focal_class.original_string: private static final long serialVersionUID = -3231787633598409157L;
focal_class.type: long
focal_class.var_name: serialVersionUID
focal_class.declarator: minSizeToBeCompressed
focal_class.modifier: private final
focal_class.original_string: private final int minSizeToBeCompressed;
focal_class.type: int
focal_class.var_name: minSizeToBeCompressed
focal_class.declarator: minImpurityIncreaseForRecord
focal_class.modifier: private final
focal_class.original_string: private final double minImpurityIncreaseForRecord;
focal_class.type: double
focal_class.var_name: minImpurityIncreaseForRecord
focal_class.declarator: minImpurityDecreaseForRecord
focal_class.modifier: private final
focal_class.original_string: private final double minImpurityDecreaseForRecord;
focal_class.type: double
focal_class.var_name: minImpurityDecreaseForRecord
focal_class.file: modules/ml/src/main/java/org/apache/ignite/ml/tree/impurity/util/SimpleStepFunctionCompressor.java
focal_class.identifier: SimpleStepFunctionCompressor
focal_class.interfaces: implements StepFunctionCompressor<T>
focal_class.class_method_signature: SimpleStepFunctionCompressor.SimpleStepFunctionCompressor()
focal_class.full_signature: public  SimpleStepFunctionCompressor()
focal_class.identifier: SimpleStepFunctionCompressor
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  SimpleStepFunctionCompressor()
focal_class.class_method_signature: SimpleStepFunctionCompressor.SimpleStepFunctionCompressor(int minSizeToBeCompressed, double minImpurityIncreaseForRecord,
          double minImpurityDecreaseForRecord)
focal_class.full_signature: public  SimpleStepFunctionCompressor(int minSizeToBeCompressed, double minImpurityIncreaseForRecord,
          double minImpurityDecreaseForRecord)
focal_class.identifier: SimpleStepFunctionCompressor
focal_class.modifiers: public
focal_class.parameters: (int minSizeToBeCompressed, double minImpurityIncreaseForRecord,
          double minImpurityDecreaseForRecord)
focal_class.signature:  SimpleStepFunctionCompressor(int minSizeToBeCompressed, double minImpurityIncreaseForRecord,
          double minImpurityDecreaseForRecord)
focal_class.class_method_signature: SimpleStepFunctionCompressor.compress(StepFunction<T> function)
focal_class.full_signature: @Override public StepFunction<T> compress(StepFunction<T> function)
focal_class.identifier: compress
focal_class.modifiers: @Override public
focal_class.parameters: (StepFunction<T> function)
focal_class.return: StepFunction<T>
focal_class.signature: StepFunction<T> compress(StepFunction<T> function)
focal_class.class_method_signature: SimpleStepFunctionCompressor.compress(List<StepFunctionPoint> points)
focal_class.full_signature: private List<StepFunctionPoint> compress(List<StepFunctionPoint> points)
focal_class.identifier: compress
focal_class.modifiers: private
focal_class.parameters: (List<StepFunctionPoint> points)
focal_class.return: List<StepFunctionPoint>
focal_class.signature: List<StepFunctionPoint> compress(List<StepFunctionPoint> points)
focal_method.body: @Override public StepFunction<T> compress(StepFunction<T> function) {
          double[] arguments = function.getX();
          T[] values = function.getY();
  
          if (arguments.length >= minSizeToBeCompressed) {
              List<StepFunctionPoint> points = new ArrayList<>();
  
              for (int i = 0; i < arguments.length; i++)
                  points.add(new StepFunctionPoint(arguments[i], values[i]));
  
              points = compress(points);
  
              double[] resX = new double[points.size()];
              T[] resY = Arrays.copyOf(values, points.size());
  
              for (int i = 0; i < points.size(); i++) {
                  StepFunctionPoint pnt = points.get(i);
                  resX[i] = pnt.x;
                  resY[i] = pnt.y;
              }
  
              return new StepFunction<>(resX, resY);
          }
  
          return function;
      }
focal_method.class_method_signature: SimpleStepFunctionCompressor.compress(StepFunction<T> function)
focal_method.full_signature: @Override public StepFunction<T> compress(StepFunction<T> function)
focal_method.identifier: compress
focal_method.invocations: getX getY add compress size copyOf size size get
focal_method.modifiers: @Override public
focal_method.parameters: (StepFunction<T> function)
focal_method.return: StepFunction<T>
focal_method.signature: StepFunction<T> compress(StepFunction<T> function)