.height(d) .period(period) .area(ordersPerPeriod)
/** * @return The test configs. */ @Parameters public static Collection<Object[]> data() { return Arrays .asList(new Object[][] { {IntensityFunctions.sineIntensity().area(10).period(20).build()}, {IntensityFunctions.sineIntensity().area(10).height(.5).period(20) .build()}, {IntensityFunctions.sineIntensity().area(10).height(-.5).period(20) .build()}, {IntensityFunctions.sineIntensity().area(10).phaseShift(0) .period(20) .build()}, {IntensityFunctions.sineIntensity().area(10).height(1).period(20) .build()} }); }
.height(.1) .build(); assertEquals(.369903, sine.area(), 0.000001); sine = (SineIntensity) IntensityFunctions.sineIntensity().height(-.1) .build(); assertEquals(.269903, sine.area(), 0.000001); .amplitude(5d) .period(3600d) .height(10) .build(); assertEquals(36000, sine.area(), 0.00001); .amplitude(5d) .frequency(1d / 10d) .height(2) .build(); assertEquals(27.2065, sine.area(), 0.0001);
/** * Check whether the * {@link TimeSeries#nonHomogenousPoisson(double, StochasticSupplier)} * function behaves as expected. */ @Test public void test2() { final IntensityFunction func1 = IntensityFunctions.sineIntensity() .period(60) .height(-.5) .build(); final IntensityFunction func2 = IntensityFunctions.sineIntensity() .period(30) .height(1.5) .build(); final StochasticSupplier<IntensityFunction> funcSup = StochasticSuppliers .fromIterable(Iterables.cycle(func1, func2)); final TimeSeriesGenerator tsg = TimeSeries.nonHomogenousPoisson(120, funcSup); // note that these tests will not work for all results of the // TimeSeriesGenerator, it is possible (but less likely) that the produced // dynamism values are different from the expectations as expressed in the // tests below. for (int i = 0; i < 20; i++) { assertTrue(Metrics.measureDynamism(tsg.generate(i), 120) < .25); assertTrue(Metrics.measureDynamism(tsg.generate(i), 120) > .40); } }
/** * @return Test configs */ @Parameters public static Collection<Object[]> data() { return Arrays.asList(new Object[][] { {TimeSeries.homogenousPoisson(60d, 10)}, {TimeSeries.homogenousPoisson(60d, 100)}, {TimeSeries.homogenousPoisson(180d, 10)}, {TimeSeries.homogenousPoisson(180d, 100)}, {TimeSeries.nonHomogenousPoisson(60d, IntensityFunctions .sineIntensity() .period(60).area(10).build())}, {TimeSeries.nonHomogenousPoisson(60d, IntensityFunctions .sineIntensity() .period(60).area(10).phaseShift(2).build())}, {TimeSeries.nonHomogenousPoisson(60d, IntensityFunctions .sineIntensity() .period(60).area(10).height(1).build())}, {TimeSeries.nonHomogenousPoisson(300d, IntensityFunctions .sineIntensity() .period(60).area(10).height(1).build())}, {TimeSeries.nonHomogenousPoisson(600d, IntensityFunctions .sineIntensity() .period(600).area(200).height(1).build())} }); }