MCPcopy Create free account
hub / github.com/chaoshangcs/GTS / eval_static

Function eval_static

scripts/eval_baseline_methods.py:89–99  ·  view source on GitHub ↗
(traffic_reading_df)

Source from the content-addressed store, hash-verified

87
88
89def eval_static(traffic_reading_df):
90 logger.info('Static')
91 horizons = [1, 3, 6, 12]
92 logger.info('\t'.join(['Model', 'Horizon', 'RMSE', 'MAPE', 'MAE']))
93 for horizon in horizons:
94 y_predict, y_test = static_predict(traffic_reading_df, n_forward=horizon, test_ratio=0.2)
95 rmse = masked_rmse_np(preds=y_predict.as_matrix(), labels=y_test.as_matrix(), null_val=0)
96 mape = masked_mape_np(preds=y_predict.as_matrix(), labels=y_test.as_matrix(), null_val=0)
97 mae = masked_mae_np(preds=y_predict.as_matrix(), labels=y_test.as_matrix(), null_val=0)
98 line = 'Static\t%d\t%.2f\t%.2f\t%.2f' % (horizon, rmse, mape * 100, mae)
99 logger.info(line)
100
101
102def eval_historical_average(traffic_reading_df, period):

Callers 1

mainFunction · 0.85

Calls 4

masked_rmse_npFunction · 0.90
masked_mape_npFunction · 0.90
masked_mae_npFunction · 0.90
static_predictFunction · 0.85

Tested by

no test coverage detected