PewmaPointForecaster implements PointForecaster { @Override public PointForecast forecast(MetricData metricData) { notNull(metricData, "metricData can't be null"); val observed = metricData.getValue(); updateEstimates(observed); return new PointForecast(mean, false); } PewmaPointForecaster();  PewmaPointForecaster(PewmaPointForecasterParams params); @Override PointForecast forecast(MetricData metricData);  }
@Test public void testForecast() { val testRows = readData_calInflow().listIterator(); val observed0 = testRows.next().getObserved(); val params = new PewmaPointForecasterParams() .setAlpha(DEFAULT_ALPHA) .setBeta(0.5) .setInitMeanEstimate(observed0); val forecaster = new PewmaPointForecaster(params); assertEquals(params, forecaster.getParams()); while (testRows.hasNext()) { val testRow = testRows.next(); val observed = testRow.getObserved(); val metricData = new MetricData(metricDef, observed, epochSecond); forecaster.forecast(metricData); assertEquals(testRow.getMean(), forecaster.getMean(), TOLERANCE); assertEquals(testRow.getStd(), forecaster.getStdDev(), TOLERANCE); } }
@Test(expected = IllegalArgumentException.class) public void testForecast_nullMetricData() { val forecaster = new PewmaPointForecaster(); forecaster.forecast(null); }