-
大小: 2KB文件类型: .py金币: 1下载: 0 次发布日期: 2021-06-02
- 语言: Python
- 标签: LSTM DeepLEarning
资源简介
用 LSTM 做时间序列预测的一个小例子,详情见我滴博文。
代码片段和文件信息
import numpy
import matplotlib.pyplot as plt
from pandas import read_csv
import math
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import LSTM
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import mean_squared_error
import pandas as pd
import os
from keras.models import Sequential load_model
# load the dataset
dataframe = read_csv(‘./international-airline-passengers.csv‘ usecols=[1] engine=‘python‘ skipfooter=3)
dataset = dataframe.values
train_size = int(len(dataset) * 0.65)
scaler = MinMaxScaler(feature_range=(0 1))
dataset = scaler.fit_transform(dataset)
trainlist = dataset[:train_size:]
testlist = dataset[train_size::]
# X is the number of passengers at a given time (t) and Y is the number of passengers at the next time (t + 1).
# convert an array of values into a dataset matrix
def create_dataset(dataset look_back):
#这里的look_back与timestep相同
dataX dataY = [] []
for i in range(len(dataset)-look_back-1):
a = dataset[i:(i+look_back)]
dataX.append(a)
dataY.append(dataset[i+look_back])
return numpy.array(dataX)n
- 上一篇:python实现视频直播
- 下一篇:21天学通python.txt
相关资源
- lstm_attention文本分类代码
- 基于LSTM的RNN网络人体骨骼关节点检测
- 时间长短序列网络LSTM
- Tensorflow-BiLSTM分类
- lstm实现时间序列一维预测
- keras上LSTM长短期记忆网络金融时序预
- 基于LSTM的航班乘客预测
- dqn_agent-master
- lstm_tensorflow
- LSTM股票预测
- arima预测附Python和测试数据
- lstm情感分析代码
- tensorflow下用LSTM网络进行时间序列预测
- 股票预测 LSTM 时间序列rnn 代码程序数
- LSTMLong Short-Term Memory长短期记忆网络
- 卷积LSTM代码
- LSTM上证指数收盘价预测.zip
- 非常简易的keras函数式Functional模型学
评论
共有 条评论