我在模仿这个page中的代码,使用LSTM来预测时间序列行为。我使用R
,所以我只是翻译了内容,并使用Rkeras
包将其改编为我的数据集。你知道吗
所以,就这样,我有了
train_input
是8到21之间的随机数向量,比如说[9,10,19,17,…]。train_output
是经过一步移位的train_input
向量:[10,19,17,…]。你知道吗
model <- keras_model_sequential()
model %>% layer_lstm(model,4,input_shape=c(1,1)%>% layer_dense(1)
model %>%compile(loss="mean_squared_error",optimizer="adam")
model %>% fit(train_input,train_output)
model %>% predict(test)
下面是我用期望的3D
格式格式化train_input
,方法是
train_input <- array(train_input,dim=c(length(train_input),1,1))
现在,当我对一个测试向量运行mod%>% predict(test)
时,我得到了0
和1
之间的非相干数,就好像概率已经被计算过一样。有人解释吗?你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐