DL之LSTM:基于tensorflow框架利用LSTM算法对气温数据集训练并回归预测
【摘要】 DL之LSTM:基于tensorflow框架利用LSTM算法对气温数据集训练并回归预测
目录
输出结果
核心代码
输出结果
数据集
tensorboard可视化
iter: 0 loss: 0.010328549iter: 500 los...
DL之LSTM:基于tensorflow框架利用LSTM算法对气温数据集训练并回归预测
目录
输出结果
数据集
tensorboard可视化
-
iter: 0 loss: 0.010328549
-
iter: 500 loss: 0.0044991444
-
iter: 1000 loss: 0.003714567
-
iter: 1500 loss: 0.0033356838
-
iter: 2000 loss: 0.003116763
-
iter: 2500 loss: 0.0029606873
-
iter: 3000 loss: 0.0028696475
-
iter: 3500 loss: 0.0026985144
-
iter: 4000 loss: 0.0025833827
-
iter: 4500 loss: 0.0024938423
-
iter: 5000 loss: 0.0024183288
-
iter: 5500 loss: 0.0023511213
-
iter: 6000 loss: 0.0022882319
-
iter: 6500 loss: 0.0022265154
-
iter: 7000 loss: 0.002163515
-
iter: 7500 loss: 0.0020974649
-
iter: 8000 loss: 0.0020275544
-
iter: 8500 loss: 0.0019528335
-
iter: 9000 loss: 0.0018700107
-
iter: 9500 loss: 0.0017752206
-
iter: 10000 loss: 0.0016714178
-
iter: 10500 loss: 0.0015757289
-
iter: 11000 loss: 0.0015021019
-
iter: 11500 loss: 0.0014435991
-
iter: 12000 loss: 0.0013950231
-
iter: 12500 loss: 0.0013551206
-
iter: 13000 loss: 0.0013215576
-
iter: 13500 loss: 0.0012917771
-
iter: 14000 loss: 0.0012640483
-
iter: 14500 loss: 0.0012376485
-
iter: 15000 loss: 0.0012124979
-
iter: 15500 loss: 0.0011886061
-
iter: 16000 loss: 0.0011660281
-
iter: 16500 loss: 0.0011447266
-
iter: 17000 loss: 0.0011244208
-
iter: 17500 loss: 0.001104528
-
iter: 18000 loss: 0.0010844271
-
iter: 18500 loss: 0.0010633252
-
iter: 19000 loss: 0.0010399523
-
iter: 19500 loss: 0.001011961
-
iter: 20000 loss: 0.00097585854
-
iter: 20500 loss: 0.00093142985
-
iter: 21000 loss: 0.00089110696
-
iter: 21500 loss: 0.00086476567
-
iter: 22000 loss: 0.00084816053
-
iter: 22500 loss: 0.0008364689
-
iter: 23000 loss: 0.00082719745
-
iter: 23500 loss: 0.000819149
-
iter: 24000 loss: 0.00081174297
-
iter: 24500 loss: 0.00080478605
-
iter: 25000 loss: 0.0007982892
-
iter: 25500 loss: 0.00079225213
-
iter: 26000 loss: 0.0007866463
-
iter: 26500 loss: 0.0007813923
-
iter: 27000 loss: 0.00077644055
-
iter: 27500 loss: 0.00077167765
-
iter: 28000 loss: 0.00076701824
-
iter: 28500 loss: 0.0007624052
-
iter: 29000 loss: 0.00075781584
-
iter: 29500 loss: 0.00075323426
-
iter: 30000 loss: 0.0007487352
-
iter: 30500 loss: 0.00074437447
-
iter: 31000 loss: 0.000740188
-
iter: 31500 loss: 0.00073620223
-
iter: 32000 loss: 0.0007323837
-
iter: 32500 loss: 0.00072883896
-
iter: 33000 loss: 0.0007253971
-
iter: 33500 loss: 0.0007672859
-
iter: 34000 loss: 0.00074850733
-
iter: 34500 loss: 0.0007547441
-
iter: 35000 loss: 0.00075676554
-
iter: 35500 loss: 0.00075801736
-
iter: 36000 loss: 0.00075870997
-
iter: 36500 loss: 0.0007588421
-
iter: 37000 loss: 0.0007584684
-
iter: 37500 loss: 0.00075732305
-
iter: 38000 loss: 0.0007555771
-
iter: 38500 loss: 0.00075331994
-
iter: 39000 loss: 0.0007502647
-
iter: 39500 loss: 0.00074706867
核心代码
DL之LSTM:基于tensorflow框架利用LSTM算法对气温数据集训练并预测
-
def LSTM(X):
-
batch_size=tf.shape(X)[0]
-
time_step=tf.shape(X)[1]
-
w_in=weights['in']
-
b_in=biases['in']
-
input=tf.reshape(X,[-1,input_size])
-
-
input_rnn=tf.matmul(input,w_in)+b_in
-
input_rnn=tf.reshape(input_rnn,[-1,time_step,rnn_unit])
-
-
cell=tf.contrib.rnn.BasicLSTMCell(rnn_unit)
-
#cell=tf.contrib.rnn.core_rnn_cell.BasicLSTMCell(rnn_unit)
-
init_state=cell.zero_state(batch_size,dtype=tf.float32)
-
output_rnn,final_states=tf.nn.dynamic_rnn(cell, input_rnn,initial_state=init_state, dtype=tf.float32)
-
-
output=tf.reshape(output_rnn,[-1,rnn_unit])
-
w_out=weights['out']
-
b_out=biases['out']
-
pred=tf.matmul(output,w_out)+b_out
-
return pred,final_states
文章来源: yunyaniu.blog.csdn.net,作者:一个处女座的程序猿,版权归原作者所有,如需转载,请联系作者。
原文链接:yunyaniu.blog.csdn.net/article/details/103746235
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)