class NetConfig():
def __init__(self):
self.rnn_unit = 10
self.input_size = 7
self.output_size = 1
self.lr = 0.0006
self.time_step = 20
self.batch_size = 80
self.weights={
'in':tf.Variable(tf.random_normal([self.input_size,self.rnn_unit])),
'out':tf.Variable(tf.random_normal([self.rnn_unit,self.output_size]))
}
self.biases={
'in':tf.Variable(tf.constant(0.1,shape=[self.rnn_unit,])),
'out':tf.Variable(tf.constant(0.1,shape=[self.output_size,]))
}
class MyModel():
def __init__(self):
self.sess = tf.Session()
self.nc = NetConfig()
def lstm(self, X):
weights = self.nc.weights
biases = self.nc.biases
input_size = self.nc.input_size
rnn_unit = self.nc.rnn_unit
output_size = self.nc.output_size
time_step = self.nc.time_step
batch_size = self.nc.batch_size
lr = self.nc.lr
sess = self.sess
batch_size=tf.shape(X)[0]
time_step
LSTM预测股票数据--模型和参数
最新推荐文章于 2023-06-06 17:55:53 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)