Cap all prediction values to zero

This commit is contained in:
reedts 2018-08-13 14:42:31 +02:00
parent aec38b2764
commit 68e9b9ddd0

View file

@ -64,7 +64,8 @@ def plot_training(evaluation):
def predict(nn, X_pred): def predict(nn, X_pred):
pred = nn.predict1h(X_pred) pred = nn.predict1h(X_pred)
predictions = np.array([p['predictions'] for p in pred]) # Cap results to 0
predictions = np.array([max(p['predictions'], 0) for p in pred])
return predictions return predictions
@ -80,7 +81,7 @@ def predict24h(nn, X_pred):
# Remove first value and append predicted value # Remove first value and append predicted value
del input['dc'][0] del input['dc'][0]
input['dc'].append(predictions[-1]) input['dc'].append(predictions[-1])
print(input) print("Prediction for hour %d/%d" % (i+1, 24))
return predictions return predictions