FD_predictions = LSTMIMO.predict(concat_input)
 FD_eval_df = create_evaluation_df(FD_predictions, test_inputs, HORIZON,
                                   y_scaler)
 preds, actuals = format_output(FD_eval_df)
 preds = preds[np.where(preds.index.hour == 0)[0][0]:][::24]
 actuals = actuals[np.where(actuals.index.hour == 0)[0][0]:][::24]
 full = actuals.merge(preds,
                      how='inner',
                      left_index=True,
                      right_index=True,
                      suffixes=('_actuals', '_preds'))
 full.to_csv('./results/' + dset + '/' + wandb.run.name + '_' + str(i) +
             '.csv')
 preds = flatten(preds.values.tolist())
 actuals = flatten(actuals.values.tolist())
 mae = validation(preds, actuals, 'MAE')
 mape = validation(preds, actuals, 'MAPE')
 rmse = validation(preds, actuals, 'RMSE')
 #print('rmse {}'.format(rmse))
 metrics.loc[i] = pd.Series({
     'mae': mae,
     'mape': mape,
     'rmse': rmse,
     'B': names[i]
 })
 wandb.log({"mape": metrics.mape.mean()})
 wandb.log({"rmse": metrics.rmse.mean()})
 wandb.log({"mae": metrics.mae.mean()})
 model_path = './models/' + dset + '_models/local/' + names[
     i] + '_' + wandb.run.name
 save_model(LSTMIMO, model_path)
示例#2
0
                       batch_size=BATCHSIZE,
                       epochs=MAX_EPOCHS,
                       validation_split=0.15,
                       callbacks=[early_stopping,
                                  WandbCallback()],
                       verbose=1)
 concat_input = tf.concat([test_inputs['X'], test_inputs['X2']], axis=2)
 FD_predictions = LSTMIMO.predict(concat_input)
 FD_eval_df = create_evaluation_df(FD_predictions, test_inputs, HORIZON,
                                   y_scaler)
 FD_eval_df.index = pd.to_datetime(FD_eval_df['timestamp'])
 FD_eval_df = FD_eval_df[np.where(
     FD_eval_df.index.hour == 0)[0][0]:][::24]
 FD_eval_df.to_csv('./results/' + dset + '/local/' + wandb.run.name +
                   '_' + str(i) + '.csv')
 mae = validation(FD_eval_df['prediction'], FD_eval_df['actual'], 'MAE')
 mape = validation(FD_eval_df['prediction'], FD_eval_df['actual'],
                   'MAPE')
 rmse = validation(FD_eval_df['prediction'], FD_eval_df['actual'],
                   'RMSE')
 #print('rmse {}'.format(rmse))
 metrics.loc[i] = pd.Series({
     'mae': mae,
     'mape': mape,
     'rmse': rmse,
     'B': names[i]
 })
 wandb.log({"mape": metrics.mape.mean()})
 wandb.log({"rmse": metrics.rmse.mean()})
 wandb.log({"mae": metrics.mae.mean()})
 model_path = './models/' + dset + '_models/local/' + names[