码迷,mamicode.com
首页 > 其他好文 > 详细

Kaggle Learn Time Series Modeling 学习小计

时间:2018-12-27 13:27:21      阅读:292      评论:0      收藏:0      [点我收藏+]

标签:return   博客   nal   div   star   ict   htm   from   rms   

 

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 学习小计

标签:return   博客   nal   div   star   ict   htm   from   rms   

原文地址:https://www.cnblogs.com/xbit/p/10184176.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!