4Manuals

  • PDF Cloud HOME

如何用LSTM预测未来60天的股价? Download

    Tesseract 4.0.0培训步骤,针对带有扫描图像的新语言 Tensorflow多线程推理比单线程推理慢 使用AND条件进行关联规则挖掘 从python中的单词列表中单词单词化? 为什么随机森林或决策树不能给出100%的精度?以及如何处理中间的巨大噪音? 尝试将RESNET50与我的模型结合使用时的准确性低 将CNN模型保存到h5文件中时的奇怪行为 x-o AI brain.js 在每个步骤进行角膜训练后获得验证的所有详细信息 sklearn SVM分类器的置信度阈值

df = df['Close'].values
df = df.reshape(-1,1)
dataset_train = np.array(df[:int(df.shape[0]*0.8)])
dataset_test = np.array(df[int(df.shape[0]*0.8)-50:])
scaler = MinMaxScaler(feature_range=(0,1))
dataset_train = scaler.fit_transform(dataset_train)

#
def create_my_dataset(df):
x = []
y = []
for i in range(50,df.shape[0]):
    x.append(df[i-50:i,0])
    y.append(df[i,0])
    x = np.array(x)
    y = np.array(y)
    return x,y

 x_train, y_train = create_my_dataset(dataset_train)
 x_test, y_test = create_my_dataset(dataset_test)
 x_train = np.reshape(x_train, (x_train.shape[0],x_train.shape[1],1))
 x_test = np.reshape(x_test, (x_test.shape[0], x_test.shape[1],1))

tf.logging.set_verbosity(tf.logging.ERROR)
model = Sequential()
model.add(LSTM(units= 100, return_sequences=True, input_shape=(x_train.shape[1],1)))
model.add(Dropout(0.2))
model.add(LSTM(units= 100, return_sequences=True))
model.add(Dropout(0.2))
model.add(LSTM(units= 100))
model.add(Dropout(0.2))
model.add(Dense(units=1))

model.compile(loss='mean_squared_error', optimizer ='adam')
model.fit(x_train, epochs=50, batch_size=32)

所以我开发了一个非常简单的代码,从2010年1月1日至2019年11月19日以lstm收盘价 我想做的就是找出该模型可以预测的2020年1月10日。我将如何做?

0 个答案:

没有答案



Similar searches
    通过联接将多个表中的不同列更新 在登录页面中禁用右键单击extjs不起作用 Scala:从大纪元开始的星期几 snaptube如何识别何时复制链接? 呈现闪亮:响应式数据加载前出现红色错误