hichenway / stock_predict_with_lstm Goto Github PK
View Code? Open in Web Editor NEWPredict stock with LSTM supporting pytorch, keras and tensorflow
License: Apache License 2.0
Predict stock with LSTM supporting pytorch, keras and tensorflow
License: Apache License 2.0
代码中的注释有写到,在非连续训练模式下,每time_step行数据会作为一个样本,两个样本错开一行,比如:1-20行,2-21行
比如有1000行的数据,n_past为10,特征是5个,那么构建出来的train_x shape为(991,10,5),train_y shape为(991,10,1),也就是对于每一个样本,使用过去10条数据来预测结果,并和真值相比较。
但是如果是用来预测,构建的test_X的shape是(100,10,5),test_Y的shape是(1000,1,5),在源码处也可以看到不是使用连续方式来构建的test_X。
所以构建出来的LSTM模型并不是输入过去n_past条数据,模型输出预测的这一条数据吗?
非常感谢楼主,您的代码直接就能运行了,质量真棒!
想请教个问题:为什么stock_predict_1.py每次执行预测的结果都不一样呢?model_save1里的文件即使删除后重新运行也是不一样的结果。
现象:每次执行计算的next_seq值都不一样,所以预测的结果也不同
next_seq=sess.run(pred,feed_dict={X:[prev_seq]})
print ("------------->"+str(next_seq))
这样训练的话每个epoch就是单独训练了吧?望解答,谢谢!
self.mean = np.mean(self.data, axis=0) # 数据的均值和方差
self.std = np.std(self.data, axis=0)
self.norm_data = (self.data - self.mean)/self.std # 归一化,去量纲
ValueError: Attempt to have a second RNNCell use the weights of a variable scope that already has weights: 'sec_lstm/rnn/basic_lstm_cell'; and the cell was not constructed as BasicLSTMCell(..., reuse=True). To share the weights of an RNNCell, simply reuse it in your second calculation, or create a new one with the argument reuse=True.
最近初学tensorflow,在博客上看到您的代码下载了运行后报了错,我在网上搜了很多方案都不行,非常困惑,恳请您能指点一下,谢谢
我把这个do_train_visualized = False改成True会报错:ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。该怎么解决。
Excuse me ? I found your datas are all singe variable, however, your paper said that your work is aimed at multivariate time-series, so do you have another codes or if it is my fault to understand this code?
stock_predict_2.py 中,定义了drop = tf.nn.rnn_cell.DropoutWrapper(basicLstm, output_keep_prob=keep_prob) ,但是实际并没有使用它,这里产生作用了吗?
作者您好 你的代码中好像没有考虑时间特征
Hello, thanks for you work.
In your case, while set do_continue_train is False, the train data must be a continuous series and can only be a series. So, my problem is, how should I train my data with serveral multi-series data?
Looking forward to your reply, thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.