【发布时间】:2020-12-15 20:45:11
【问题描述】:
我有 100 个人在 1 年内的销售额数据。
我想让 ONE 模型预测所有 100 次销售男士的销售。
这是我的代码:
model=Sequential()
y_train=sells_men_sell[1] # sells_men_sell[1] is a 1d array that contains the first sells man's sells record
x_train=sells_men_data[1] # sells_men_sell[1] is a array that contains the first sells man's sells record for training
#, each value in the array(sells_men_sell) contains the sells record for the past 30 days.
model.add(LSTM(50, input_shape=(x_train.shape[1], x_train.shape[2])))
model.add(Dense(1))
model.compile(loss='mean_squared_error', optimizer='adam')
model.fit(x_train, y_train, batch_size=1, epoch=1)
我知道在一个模型中预测 100 名销售人员听起来很奇怪,但我这样做是为了一个项目。
我应该如何处理我的代码?
我应该在model.fit(x_train, y_train, batch_size=1, epoch=1)之后添加以下代码吗?
y_train1=sells_men_sell[2] # sells_men_sell[2] is a 1d array that contains the second sells man's sells record
x_train1=sells_men_data[2] # sells_men_sell[2] is a array that contains the second sells man's sells record for training
model.add(LSTM(50, input_shape=(x_train1.shape[1], x_train1.shape[2])))
model.fit(x_train1, y_train1, batch_size=1, epoch=1)
【问题讨论】:
-
你的模型有 100 个不同的输入层吗?
-
Aniket Bote,你的意思是在模型中添加 100 个 LSTM 层吗?
-
检查下面的答案。那是你要的吗。我已经根据你的标题给出了答案。
-
你能解释一下你到底想要什么,以便我修改我的答案。
标签: python machine-learning keras neural-network lstm