@Test public void testNullParamFails() { expectedEx.expect(IllegalArgumentException.class); expectedEx.expectMessage("params can't be null"); HoltWintersSimpleTrainingModel subject = new HoltWintersSimpleTrainingModel(HoltWintersAustouristsTestHelper.buildAustouristsParams(HoltWintersSeasonalityType.MULTIPLICATIVE)); subject.observeAndTrain(0, null, null); }
public void observeAndTrain(double y, HoltWintersPointForecasterParams params, HoltWintersOnlineComponents components) { checkNulls(params, components); checkTrainingMethod(params); checkStillInInitialTraining(params); int frequency = params.getFrequency(); if (isBetween(n, 0, frequency - 1)) { firstCycle[n] = y; } else { secondCycle[n - frequency] = y; } if (n == params.calculateInitTrainingPeriod() - 1) { setLevel(components); setSeasonals(y, params, components); setBase(params, components); updateComponentsAndForecast(params, components); } n++; }
HoltWintersSimpleTrainingModel { public void observeAndTrain(double y, HoltWintersPointForecasterParams params, HoltWintersOnlineComponents components) { checkNulls(params, components); checkTrainingMethod(params); checkStillInInitialTraining(params); int frequency = params.getFrequency(); if (isBetween(n, 0, frequency - 1)) { firstCycle[n] = y; } else { secondCycle[n - frequency] = y; } if (n == params.calculateInitTrainingPeriod() - 1) { setLevel(components); setSeasonals(y, params, components); setBase(params, components); updateComponentsAndForecast(params, components); } n++; } }
HoltWintersSimpleTrainingModel { public void observeAndTrain(double y, HoltWintersPointForecasterParams params, HoltWintersOnlineComponents components) { checkNulls(params, components); checkTrainingMethod(params); checkStillInInitialTraining(params); int frequency = params.getFrequency(); if (isBetween(n, 0, frequency - 1)) { firstCycle[n] = y; } else { secondCycle[n - frequency] = y; } if (n == params.calculateInitTrainingPeriod() - 1) { setLevel(components); setSeasonals(y, params, components); setBase(params, components); updateComponentsAndForecast(params, components); } n++; } HoltWintersSimpleTrainingModel(HoltWintersPointForecasterParams params); }
HoltWintersSimpleTrainingModel { public void observeAndTrain(double y, HoltWintersPointForecasterParams params, HoltWintersOnlineComponents components) { checkNulls(params, components); checkTrainingMethod(params); checkStillInInitialTraining(params); int frequency = params.getFrequency(); if (isBetween(n, 0, frequency - 1)) { firstCycle[n] = y; } else { secondCycle[n - frequency] = y; } if (n == params.calculateInitTrainingPeriod() - 1) { setLevel(components); setSeasonals(y, params, components); setBase(params, components); updateComponentsAndForecast(params, components); } n++; } HoltWintersSimpleTrainingModel(HoltWintersPointForecasterParams params); void observeAndTrain(double y, HoltWintersPointForecasterParams params, HoltWintersOnlineComponents components); boolean isTrainingComplete(HoltWintersPointForecasterParams params); }
HoltWintersSimpleTrainingModel { public void observeAndTrain(double y, HoltWintersPointForecasterParams params, HoltWintersOnlineComponents components) { checkNulls(params, components); checkTrainingMethod(params); checkStillInInitialTraining(params); int frequency = params.getFrequency(); if (isBetween(n, 0, frequency - 1)) { firstCycle[n] = y; } else { secondCycle[n - frequency] = y; } if (n == params.calculateInitTrainingPeriod() - 1) { setLevel(components); setSeasonals(y, params, components); setBase(params, components); updateComponentsAndForecast(params, components); } n++; } HoltWintersSimpleTrainingModel(HoltWintersPointForecasterParams params); void observeAndTrain(double y, HoltWintersPointForecasterParams params, HoltWintersOnlineComponents components); boolean isTrainingComplete(HoltWintersPointForecasterParams params);  }