Kaggle Learn Time Series Modeling 学习小计

Posted xbit

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Kaggle Learn Time Series Modeling 学习小计相关的知识,希望对你有一定的参考价值。

 

ARIMA模型,参数含义参考:https://www.cnblogs.com/bradleon/p/6827109.html

from statsmodels.tsa.arima_model import ARIMA
plt.figure(figsize = (15,8))
model = ARIMA(Train_log, order = (2,1,0))  #here q value is zero since it is just AR Model

 

SARIMAX Model,多元季节性时间序列模型,用于预测与异常诊断,参考博客:https://blog.csdn.net/weixin_41512727/article/details/82999831

import statsmodels.api as sm
y_hat_avg = valid.copy()
fit1 = sm.tsa.statespace.SARIMAX(Train.Count, order = (2,1,4), seasonal_order =(0,1,1,7)).fit()
y_hat_avg[SARIMA] = fit1.predict(start="2014-6-25", end="2014-9-25", dynamic=True)

 

LSTM Model

import numpy as np
from numpy import newaxis
from keras.layers.core import Dense, Activation, Dropout
from keras.layers.recurrent import LSTM
from keras.models import Sequential

my_model = Sequential()

my_model.add(LSTM(
    input_shape=(None, 1),
    units=50,
    return_sequences=True))


my_model.add(LSTM(100, return_sequences=False))
my_model.add(Dropout(0.5))

my_model.add(Dense(1))
my_model.add(Activation(linear))

my_model.compile(loss=mse, optimizer=rmsprop)

# Fill in the parameters to fit your model
my_model.fit(
    X_train,
    y_train,
    batch_size=1024,   # Fill this in
    epochs=1,       # Fill this in
    validation_split=0.05)

 

以上是关于Kaggle Learn Time Series Modeling 学习小计的主要内容,如果未能解决你的问题,请参考以下文章

Time-series Storage Layer Time Series Databases 时间序列

Time series analysis

python 笔记:tslearn (数据部分)

Kaggle-pandas

time series review

STA457 Time Series Analysis