Search in sources :

Example 1 with Horizon

use of com.axibase.tsd.api.model.series.query.transformation.forecast.Horizon in project atsd-api-test by axibase.

the class PostEvaluationTest method testForecast.

@Test(description = "Interpolate and forecast evaluation-generated series.")
public void testForecast() {
    Interpolate interpolationSettings = new Interpolate(InterpolateFunction.LINEAR, period(1));
    Forecast forecastSettings = new Forecast().setHorizon(new Horizon().setLength(31)).setSsa(new SSASettings()).setInclude(Arrays.asList(SeriesType.HISTORY, SeriesType.FORECAST));
    SeriesQuery query = baseQuery.withInterpolate(interpolationSettings).withForecast(forecastSettings).withTransformationOrder(Arrays.asList(EVALUATE, INTERPOLATE, FORECAST));
    List<Series> seriesList = querySeriesAsList(query);
    assertEquals(seriesList.size(), 2 * seriesCount);
    CommonAssertions.assertSeriesSize(seriesList, 31);
    query = query.withSeriesLimit(5).withLimit(4);
    seriesList = querySeriesAsList(query);
    assertEquals(seriesList.size(), 5);
    CommonAssertions.assertSeriesSize(seriesList, 4);
}
Also used : Series(com.axibase.tsd.api.model.series.Series) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Interpolate(com.axibase.tsd.api.model.series.query.transformation.interpolate.Interpolate) SSASettings(com.axibase.tsd.api.model.series.query.transformation.forecast.SSASettings) Forecast(com.axibase.tsd.api.model.series.query.transformation.forecast.Forecast) Horizon(com.axibase.tsd.api.model.series.query.transformation.forecast.Horizon) Test(org.testng.annotations.Test)

Example 2 with Horizon

use of com.axibase.tsd.api.model.series.query.transformation.forecast.Horizon in project atsd-api-test by axibase.

the class SeriesQueryForecastTimeFilterTest method testData.

@DataProvider(parallel = false)
public Object[][] testData() {
    Interval days_2 = new Interval(2, TimeUnit.DAY);
    Interval days_3 = new Interval(3, TimeUnit.DAY);
    return new Object[][] { { new Horizon().setLength(111), false, false, 10 * 24 * 60, 111 }, // - 24*60: first period (= 1 day) of Holt-Winters reconstructed series is always zero, and not included in response
    { new Horizon().setLength(111), true, false, 11 * 8 * 60 - 24 * 60, 111 }, { new Horizon().setLength(111), true, true, 9 * 8 * 60 - 24 * 60, 111 }, { new Horizon().setLength(2 * 24 * 60), true, true, 9 * 8 * 60 - 24 * 60, 2 * 24 * 60 }, { new Horizon().setInterval(days_2), false, false, 10 * 24 * 60, 2 * 24 * 60 }, // -1: latest timestamp 17:59 is not included because it equals to end time of 2 day interval
    { new Horizon().setInterval(days_2), true, false, 11 * 8 * 60 - 24 * 60, 2 * 8 * 60 - 1 }, { new Horizon().setInterval(days_2), true, true, 9 * 8 * 60 - 24 * 60, 1 * 8 * 60 }, // +1: forecastEndTime implemented "inclusive"
    { new Horizon().setEndDate("2021-04-18T00:00:00Z"), false, false, 10 * 24 * 60, 2 * 24 * 60 + 1 }, { new Horizon().setEndDate("2021-04-18T00:00:00Z"), true, false, 11 * 8 * 60 - 24 * 60, 2 * 8 * 60 }, { new Horizon().setEndDate("2021-04-18T00:00:00Z"), true, true, 9 * 8 * 60 - 24 * 60, 1 * 8 * 60 }, { new Horizon().setStartDate("2021-04-15T00:00:00Z").setLength(111), false, false, 9 * 24 * 60, 111 }, { new Horizon().setStartDate("2021-04-15T00:00:00Z").setLength(111), true, false, 10 * 8 * 60 - 24 * 60, 111 }, { new Horizon().setStartDate("2021-04-15T00:00:00Z").setLength(111), true, true, 8 * 8 * 60 - 24 * 60, 111 }, { new Horizon().setStartDate("2021-04-15T00:00:00Z").setLength(3 * 24 * 60), true, true, 8 * 8 * 60 - 24 * 60, 3 * 24 * 60 }, { new Horizon().setStartDate("2021-04-15T00:00:00Z").setInterval(days_3), false, false, 9 * 24 * 60, 3 * 24 * 60 }, { new Horizon().setStartDate("2021-04-15T00:00:00Z").setInterval(days_3), true, false, 10 * 8 * 60 - 24 * 60, 3 * 8 * 60 - 1 }, { new Horizon().setStartDate("2021-04-15T00:00:00Z").setInterval(days_3), true, true, 8 * 8 * 60 - 24 * 60, 2 * 8 * 60 }, { new Horizon().setStartDate("2021-04-15T00:00:00Z").setEndDate("2021-04-18T00:00:00Z"), false, false, 9 * 24 * 60, 3 * 24 * 60 + 1 }, { new Horizon().setStartDate("2021-04-15T00:00:00Z").setEndDate("2021-04-18T00:00:00Z"), true, false, 10 * 8 * 60 - 24 * 60, 3 * 8 * 60 }, { new Horizon().setStartDate("2021-04-15T00:00:00Z").setEndDate("2021-04-18T00:00:00Z"), true, true, 8 * 8 * 60 - 24 * 60, 2 * 8 * 60 } };
}
Also used : Horizon(com.axibase.tsd.api.model.series.query.transformation.forecast.Horizon) Interval(com.axibase.tsd.api.model.series.query.Interval) DataProvider(org.testng.annotations.DataProvider)

Aggregations

Horizon (com.axibase.tsd.api.model.series.query.transformation.forecast.Horizon)2 Series (com.axibase.tsd.api.model.series.Series)1 Interval (com.axibase.tsd.api.model.series.query.Interval)1 SeriesQuery (com.axibase.tsd.api.model.series.query.SeriesQuery)1 Forecast (com.axibase.tsd.api.model.series.query.transformation.forecast.Forecast)1 SSASettings (com.axibase.tsd.api.model.series.query.transformation.forecast.SSASettings)1 Interpolate (com.axibase.tsd.api.model.series.query.transformation.interpolate.Interpolate)1 DataProvider (org.testng.annotations.DataProvider)1 Test (org.testng.annotations.Test)1