【问题标题】:Loss jumps in epoch graph in LSTM model- kerasLSTM 模型中 epoch 图中的损失跳跃 - keras
【发布时间】:2019-07-19 06:06:57
【问题描述】:

我在我的 LSTM 模型的历元图中看到了损失跳跃。 (附截图) 它告诉我什么? (过拟合?、错误的损失函数、错误的激活、不必要的层?等等)

LOSS PLOT

# Model
time_input= Input(shape=(timesteps,data_dim))           #inputs dimension
DKLOC_input= Input(shape=(timesteps,data_dim))  
LSTM_outs=LSTM(hidden_dim, unroll= True, return_sequences=True)(time_input)
MLP_inputs=concatenate([LSTM_outs,Feature_Data_input])

MLP_outs= Dense(MLP_hidden_dim, activation='relu')(MLP_inputs)
MLP_outs= Dense(MLP_hidden_dim, activation='relu')(MLP_outs)
outs= Dense(data_dim, activation="linear")(MLP_outs) 


#optimizaiton # compile  #fit
model = Model(inputs=[time_input,Feature_Data_input], outputs=[outs])
model.compile(loss='mse', optimizer="adam", metrics=['mse', 'mae', 'mape', 'cosine'])
history = model.fit(x=[input_data, Feature_Data_train] , y= truth, batch_size=1, epochs=1000, verbose=2)

999/1000 纪元 - 0s - 损失:0.0132 - mean_squared_error:0.0132 - mean_absolute_error:0.0619 - mean_absolute_percentage_error:45287253.3333 - cosine_proximity:-6.5984e-01 纪元 1000/1000 - 0s - 损失:0.0132 - mean_squared_error:0.0132 - mean_absolute_error:0.0618 - mean_absolute_percentage_error:45145968.0000 - cosine_proximity:-6.5985e-01

【问题讨论】:

    标签: keras lstm epoch loss


    【解决方案1】:

    我将从使用大于 1 的 batch_size 开始。您希望优化器同时考虑多个数据点,而不仅仅是单个样本。希望您的数据样本有所不同,因此您希望优化考虑一组平均值。

    【讨论】:

    • 设置 batch_size 3 或更多使我的损失曲线更平滑,谢谢!
    猜你喜欢
    • 1970-01-01
    • 2021-06-14
    • 2019-10-06
    • 2019-04-28
    • 2018-02-03
    • 1970-01-01
    • 2021-05-02
    • 1970-01-01
    • 2022-10-19
    相关资源
    最近更新 更多