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

Function eval_historical_average

scripts/eval_baseline_methods.py:102–111  ·  view source on GitHub ↗
(traffic_reading_df, period)

Source from the content-addressed store, hash-verified

100
101
102def eval_historical_average(traffic_reading_df, period):
103 y_predict, y_test = historical_average_predict(traffic_reading_df, period=period, test_ratio=0.2)
104 rmse = masked_rmse_np(preds=y_predict.as_matrix(), labels=y_test.as_matrix(), null_val=0)
105 mape = masked_mape_np(preds=y_predict.as_matrix(), labels=y_test.as_matrix(), null_val=0)
106 mae = masked_mae_np(preds=y_predict.as_matrix(), labels=y_test.as_matrix(), null_val=0)
107 logger.info('Historical Average')
108 logger.info('\t'.join(['Model', 'Horizon', 'RMSE', 'MAPE', 'MAE']))
109 for horizon in [1, 3, 6, 12]:
110 line = 'HA\t%d\t%.2f\t%.2f\t%.2f' % (horizon, rmse, mape * 100, mae)
111 logger.info(line)
112
113
114def eval_var(traffic_reading_df, n_lags=3):

Callers 1

mainFunction · 0.85

Calls 4

masked_rmse_npFunction · 0.90
masked_mape_npFunction · 0.90
masked_mae_npFunction · 0.90

Tested by

no test coverage detected