statsmodel ARIMA динамическое прогнозирование с экзогенным регрессором - PullRequest
0 голосов
/ 15 января 2019

Я пытаюсь использовать многомерную ариму для предсказания столбца price. Я тренирую модель аримы на [train_start_index:train_end_index], а позже использую ее параметры для прогнозирования новых данных.

while (train_end_index < inputNumber - 1):
        train_end_index = train_start_index + trainLength
        test_start_index = train_end_index
        test_end_index= test_start_index + horizon
        if (filteredData[test_start_index:test_end_index]["day"].values[-1] > 300) and (filteredData[test_start_index:test_end_index]["year"].values[-1] == 2017):
            return predictions, prices
        trainFeatures = filteredData[train_start_index:train_end_index]["totaltx"]
        trainOutput = filteredData[train_start_index:train_end_index]["price"]

        training_arima = sm.tsa.statespace.SARIMAX(endog=trainOutput, exog=trainFeatures, order=(window, 1, 1), trend="ct", initialization='approximate_diffuse')
        training_arima_fit = training_arima.fit(disp=0)

        testFeatures = filteredData[train_start_index:test_end_index]["totaltx"]
        testOutput = filteredData[train_start_index:test_end_index]["price"]

        test_arima = sm.tsa.statespace.SARIMAX(endog=testOutput, exog=testFeatures, order=(window, 1, 1), trend="ct", initialization='approximate_diffuse')
        #res = test_arima.filter(training_arima_fit.params)
        res=test_arima.smooth(training_arima_fit.params)

        predicted = res.predict()[-1:]
        price = filteredData[test_start_index:test_end_index]["price"].values[-1:]

        predictions = np.append(predictions, predicted.values)
        prices = np.append(prices, price)

Однако у меня здесь проблема. Для прогнозирования Price(t+horizon) я предполагаю, что у меня нет значения TotalTx(t),...,TotalTx(t+horizon). Я просто хочу предсказать цену (t + горизонт) с ранее обученной аримой. Однако ариме нужны экзогенные переменные для TotalTx(t),...,TotalTx(t+horizon).

Можно ли предложить мне модель аримы в python с экзогенным регрессором для решения проблемы?

Спасибо.

...