@Test public void testBuildDetector() { val factoryUnderTest = new LegacyHoltWintersDetectorFactoryProvider(); val document = readDocument("holt-winters"); val detector = factoryUnderTest.buildDetector(document); val hw = (HoltWintersPointForecaster) detector.getPointForecaster(); val hwParams = hw.getParams(); val welford = (ExponentialWelfordIntervalForecaster) detector.getIntervalForecaster(); val welfordParams = welford.getParams(); assertEquals(ForecastingDetector.class, detector.getClass()); assertEquals("a63c2128-113a-8fd7-942d-f8ae228b61b0", detector.getUuid().toString()); assertEquals(AnomalyType.RIGHT_TAILED, detector.getAnomalyType()); assertEquals(2016, hwParams.getFrequency()); assertEquals(0.15, hwParams.getAlpha(), TOLERANCE); assertEquals(0.10, hwParams.getBeta(), TOLERANCE); assertEquals(0.20, hwParams.getGamma(), TOLERANCE); assertEquals(0, hwParams.getWarmUpPeriod()); assertEquals(HoltWintersSeasonalityType.MULTIPLICATIVE, hwParams.getSeasonalityType()); assertEquals(HoltWintersTrainingMethod.NONE, hwParams.getInitTrainingMethod()); assertEquals(0.0, hwParams.getInitBaseEstimate(), TOLERANCE); assertEquals(0.0, hwParams.getInitLevelEstimate(), TOLERANCE); assertEquals(0, hwParams.getInitSeasonalEstimates().length); assertEquals(3.0, welfordParams.getWeakSigmas(), TOLERANCE); assertEquals(4.0, welfordParams.getStrongSigmas(), TOLERANCE); }
@Override public ForecastingDetector buildDetector(DetectorDocument document) { val uuid = document.getUuid(); val config = document.getConfig(); val type = AnomalyType.valueOf((String) config.get("type")); val paramsMap = config.get("params"); val legacyParams = objectMapper.convertValue(paramsMap, LegacyHoltWintersDetectorParams.class); val holtWintersParams = legacyParams.toHoltWintersParams(); val welfordParams = legacyParams.toWelfordParams(); val holtWinters = new HoltWintersPointForecaster(holtWintersParams); val welford = new ExponentialWelfordIntervalForecaster(welfordParams); val trusted = document.isTrusted(); return new ForecastingDetector(uuid, holtWinters, welford, type, trusted, "holtwinters"); }
LegacyHoltWintersDetectorFactoryProvider implements DetectorFactoryProvider<ForecastingDetector> { @Override public ForecastingDetector buildDetector(DetectorDocument document) { val uuid = document.getUuid(); val config = document.getConfig(); val type = AnomalyType.valueOf((String) config.get("type")); val paramsMap = config.get("params"); val legacyParams = objectMapper.convertValue(paramsMap, LegacyHoltWintersDetectorParams.class); val holtWintersParams = legacyParams.toHoltWintersParams(); val welfordParams = legacyParams.toWelfordParams(); val holtWinters = new HoltWintersPointForecaster(holtWintersParams); val welford = new ExponentialWelfordIntervalForecaster(welfordParams); val trusted = document.isTrusted(); return new ForecastingDetector(uuid, holtWinters, welford, type, trusted, "holtwinters"); } }
LegacyHoltWintersDetectorFactoryProvider implements DetectorFactoryProvider<ForecastingDetector> { @Override public ForecastingDetector buildDetector(DetectorDocument document) { val uuid = document.getUuid(); val config = document.getConfig(); val type = AnomalyType.valueOf((String) config.get("type")); val paramsMap = config.get("params"); val legacyParams = objectMapper.convertValue(paramsMap, LegacyHoltWintersDetectorParams.class); val holtWintersParams = legacyParams.toHoltWintersParams(); val welfordParams = legacyParams.toWelfordParams(); val holtWinters = new HoltWintersPointForecaster(holtWintersParams); val welford = new ExponentialWelfordIntervalForecaster(welfordParams); val trusted = document.isTrusted(); return new ForecastingDetector(uuid, holtWinters, welford, type, trusted, "holtwinters"); }  }
LegacyHoltWintersDetectorFactoryProvider implements DetectorFactoryProvider<ForecastingDetector> { @Override public ForecastingDetector buildDetector(DetectorDocument document) { val uuid = document.getUuid(); val config = document.getConfig(); val type = AnomalyType.valueOf((String) config.get("type")); val paramsMap = config.get("params"); val legacyParams = objectMapper.convertValue(paramsMap, LegacyHoltWintersDetectorParams.class); val holtWintersParams = legacyParams.toHoltWintersParams(); val welfordParams = legacyParams.toWelfordParams(); val holtWinters = new HoltWintersPointForecaster(holtWintersParams); val welford = new ExponentialWelfordIntervalForecaster(welfordParams); val trusted = document.isTrusted(); return new ForecastingDetector(uuid, holtWinters, welford, type, trusted, "holtwinters"); }  @Override ForecastingDetector buildDetector(DetectorDocument document); }
LegacyHoltWintersDetectorFactoryProvider implements DetectorFactoryProvider<ForecastingDetector> { @Override public ForecastingDetector buildDetector(DetectorDocument document) { val uuid = document.getUuid(); val config = document.getConfig(); val type = AnomalyType.valueOf((String) config.get("type")); val paramsMap = config.get("params"); val legacyParams = objectMapper.convertValue(paramsMap, LegacyHoltWintersDetectorParams.class); val holtWintersParams = legacyParams.toHoltWintersParams(); val welfordParams = legacyParams.toWelfordParams(); val holtWinters = new HoltWintersPointForecaster(holtWintersParams); val welford = new ExponentialWelfordIntervalForecaster(welfordParams); val trusted = document.isTrusted(); return new ForecastingDetector(uuid, holtWinters, welford, type, trusted, "holtwinters"); }  @Override ForecastingDetector buildDetector(DetectorDocument document);  }