数据下载类


M5

 M5 (source_url:str='https://github.com/Nixtla/m5-
     forecasts/raw/main/datasets/m5.zip')

测试序列数

评估类


M5Evaluation

 M5Evaluation ()

初始化 self。有关准确签名,请参阅 help(type(self))。

基于 URL 的评估

来自类 M5Evaluation 的方法 evaluate 可以接收一个 URL,指向 M5 竞赛的提交结果

与即时评估相比,结果取自 官方评估

m5_winner_url = 'https://github.com/Nixtla/m5-forecasts/raw/main/forecasts/0001 YJ_STU.zip'
winner_evaluation = M5Evaluation.evaluate('data', m5_winner_url)
# Test of the same evaluation as the original one
test_close(winner_evaluation.loc['Total'].item(), 0.520, eps=1e-3)
winner_evaluation

基于 Pandas 的评估

此外,方法 evaluate 可以接收一个包含预测结果的 Pandas DataFrame。

m5_second_place_url = 'https://github.com/Nixtla/m5-forecasts/raw/main/forecasts/0002 Matthias.zip'
m5_second_place_forecasts = M5Evaluation.load_benchmark('data', m5_second_place_url)
second_place_evaluation = M5Evaluation.evaluate('data', m5_second_place_forecasts)
# Test of the same evaluation as the original one
test_close(second_place_evaluation.loc['Total'].item(), 0.528, eps=1e-3)
second_place_evaluation

默认情况下,您可以使用以下方法加载获胜者基准。

winner_benchmark = M5Evaluation.load_benchmark('data')
winner_evaluation = M5Evaluation.evaluate('data', winner_benchmark)
# Test of the same evaluation as the original one
test_close(winner_evaluation.loc['Total'].item(), 0.520, eps=1e-3)
winner_evaluation

验证集评估

您还可以评估官方验证集。

winner_benchmark_val = M5Evaluation.load_benchmark('data', validation=True)
winner_evaluation_val = M5Evaluation.evaluate('data', winner_benchmark_val, validation=True)
winner_evaluation_val

Kaggle M5 竞赛参考

Favorita Kaggle 竞赛的评估指标是归一化加权均方根对数误差 (NWRMSLE)。易腐商品的分数权重为 1.25;否则,权重为 1.0。

NWRMSLE=i=1nwi(log(y^i+1)log(yi+1))2i=1nwi NWRMSLE = \sqrt{\frac{\sum^{n}_{i=1} w_{i}\left(log(\hat{y}_{i}+1) - log(y_{i}+1)\right)^{2}}{\sum^{n}_{i=1} w_{i}}}

Kaggle 竞赛预测方法提前 16 天的 NWRMSLE
LGBM [1]0.5091
Seq2Seq WaveNet [2]0.5129
  1. Corporación Favorita. Corporación favorita 杂货销售预测。Kaggle 竞赛排行榜,2018。
  2. Glib Kechyn, Lucius Yu, Yangguang Zang 和 Svyatoslav Kechyn。在 Favorita Kaggle 竞赛框架内使用 wavenet 进行销售预测。Computing Research Repository, abs/1803.04037, 2018.