相关疑难解决方法(0)

如何使用Keras模型预测未来的日期或事件?

这是我的代码,训练完整的模型并保存它:

num_units = 2
activation_function = 'sigmoid'
optimizer = 'adam'
loss_function = 'mean_squared_error'
batch_size = 10
num_epochs = 100

# Initialize the RNN
regressor = Sequential()

# Adding the input layer and the LSTM layer
regressor.add(LSTM(units = num_units, activation = activation_function, input_shape=(None, 1)))

# Adding the output layer
regressor.add(Dense(units = 1))

# Compiling the RNN
regressor.compile(optimizer = optimizer, loss = loss_function)

# Using the training set to train the model
regressor.fit(x_train, y_train, batch_size = batch_size, epochs = num_epochs)
regressor.save('model.h5')
Run Code Online (Sandbox Code Playgroud)

在那之后,我已经看到大多数时候人们建议测试数据集来检查我已经尝试过的预测并获得了良好的结果. …

python keras

12
推荐指数
1
解决办法
5711
查看次数

标签 统计

keras ×1

python ×1