'Keras 2 units output,how to modify the loss function to combine two prediction value

I'm a beginning learner of machine learning. Recently I want to do photovoltaic interval prediction and know one method is to modify the output layer unit, which can output 2 prediction values for one point directly.

After constructing lstm with two output units by Keras, I found that the two prediction values are too close to recognize from the plot and the two prediction values cannot include the real value. I think it might be caused by the loss function,I use mae before.

I want to know how to combine the ypred1 and ypred2 with the yreal to my own loss function. Here is my code:

model = Sequential()
model.add(LSTM(50, input_shape=(train_X.shape[1], train_X.shape[2])))
model.add(Dense(50,  activation='ReLU'))
model.add(Dense(2,  activation='linear'))
model.compile(loss='mse', optimizer='adam',loss_weights=None)

Can I use y1=ypred\[0\],y2=ypred\[1\] such synax?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source