AutomaticPeriodIdentification { public static int periods(final List<DataPoint> data) { return periods(data, ADF_TEST_DEFAULT_CRITICAL_PVALUE); } private  AutomaticPeriodIdentification(); static int periods(final List<DataPoint> data); static int periods(final List<DataPoint> data, double criticalValue); static final double ADF_TEST_DEFAULT_CRITICAL_PVALUE; }
@Test public void testAutomaticPeriodIdentificationVariableDataLength() throws IOException { ModelData rModel = ModelReader.read("sineTrendLowVar"); int lastIndex = rModel.getPeriods()*2; while (lastIndex < rModel.getData().size()) { List<DataPoint> trainData = rModel.getData().subList(0, lastIndex); int periods = AutomaticPeriodIdentification.periods(trainData); Assert.assertEquals(rModel.getPeriods(), periods, 1); lastIndex += ThreadLocalRandom.current().nextInt(0, rModel.getPeriods() + 1); } int[] startIndices = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 28, 47 }; for (int startIndex: startIndices) { List<DataPoint> trainData = rModel.getData().subList(startIndex, rModel.getData().size()); int periods = AutomaticPeriodIdentification.periods(trainData); Assert.assertEquals(rModel.getPeriods(), periods, 1); } }