简体   繁体   English

尽管我使用相同的代码,为什么LSTM给出不同的输出?

[英]Why LSTM give different output despite I use the same code?

I ran code from this link (for predict price of sp500) and I found that output (predicted price) are not the same when I ran the code for second and third time. 我从此链接运行了代码(用于sp500的预测价格),当我第二次和第三次运行代码时,发现输出(预测价格)不相同。 They are not even close sometimes. 他们有时甚至不靠近。 I just know the basic knowledge of LSTM and never code it before. 我只知道LSTM的基本知识,而以前从未编写过代码。

It is better to seed the inbuilt pseudo-random number generator. 最好植入内置的伪随机数生成器。 Kindly try using the following: 请尝试使用以下方法:

import random
import numpy as np
from tensorflow import set_random_seed

random.seed(10)

np.random.seed(10)

set_random_seed(10)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么结果不同,尽管代码完全相同? - Why is the result different ,despite the code is exactly the same? 为什么以下代码在 C 和 Python 中给出不同的输出? - why does following code give different output in C , Python? 为什么运行相同的代码但使用不同的名称时会得到不同的输出? - Why I get different output when I run the same code but different name? 为什么我的代码为同一个单词给出不同的数字? - Why is my code give different numbers for the same word? 为什么在不同的 python 版本上运行相同的代码会得到不同的输出? - Why do I get different output running the same code on different python versions? 为什么我在以下代码中使用的相同的Magic方法会生成与预期不同的输出 - Why is the same Magic method I used in the following code generating different output than what is expected 为什么“结果”和“当前”没有给出相同的 output 尽管它们在此代码中被提及为相同? - Why "result" and "current" doesn't give the same output though they are mentioned as the same in this code? Keras LSTM - 为什么“相同”模型和相同权重的结果不同? - Keras LSTM - why different results with “same” model & same weights? 为什么这两个代码给我不同的 output? 他们不一样吗 - Why these both code gives me different output ? Are they not the same 为什么R scale {raster}函数提供的输出与在PythonWin中缩放相同栅格的输出不同? - Why does R scale{raster} function give a different output than scaling the same raster in PythonWin?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM