I Use for my forecasting prediction Timeseries mlContext.Forecasting.ForecastBySSA.
Now I want to know from which time the next prediction is.
When I use:
var forecastingPipeline = mlContext.Forecasting.ForecastBySsa(
outputColumnName: "ForecastedFillLevel",
inputColumnName: "FillLevel",
windowSize: 7,
seriesLength: 30,
trainSize: 100,
horizon: 7,
confidenceLevel: 0.95f,
confidenceLowerBoundColumn: "LowerBoundFillLevel",
confidenceUpperBoundColumn: "UpperBoundFillLevel");
It will predict 7 values in the future, but I wanna know which DateTime in the future the prediction is based on.
In my dataset the difference of data in one day difference from 4-10 data rows in a day.
Now I use this code.
static void Forecast(IDataView testData, int horizon, TimeSeriesPredictionEngine<ModelInput, ModelOutput> forecaster, MLContext mlContext)
{
ModelOutput forecast = forecaster.Predict();
IEnumerable<string> forecastOutput =
mlContext.Data.CreateEnumerable<ModelInput>(testData, reuseRowObject: false)
.Take(horizon)
.Select((ModelInput Message, int index) =>
{
string rentalDate = Message.DateTime.ToShortDateString();
//float actualRentals = rental.FillLevel;
float lowerEstimate = Math.Max(0, forecast.LowerBoundFillLevel[index]);
float estimate = forecast.ForecastedFillLevel[index];
float upperEstimate = forecast.UpperBoundFillLevel[index];
return $"Date: {rentalDate}\n" +
// $"Actual Rentals: {actualRentals}\n" +
$"Lower Estimate: {lowerEstimate}\n" +
$"Forecast: {estimate}\n" +
$"Upper Estimate: {upperEstimate}\n";
});
// Output predictions
Console.WriteLine("Rental Forecast");
Console.WriteLine("---------------------");
foreach (var prediction in forecastOutput)
{
Console.WriteLine(prediction);
}
}
But the DateTime that gets printed are the first 7 datetime values in my dataset. The prediction values are good and based on the last datarows.
So my question is how can I print the correct DateTime values for the prediction