数据集
M4 数据集
下载并评估 M4 数据集。
M4 元信息
来源
其他
Other (seasonality:int=1, horizon:int=8, freq:str='D', name:str='Other', n_ts:int=5000, included_groups:Tuple=('Weekly', 'Daily', 'Hourly'))
来源
小时
Hourly (seasonality:int=24, horizon:int=48, freq:str='H', name:str='Hourly', n_ts:int=414)
来源
日
Daily (seasonality:int=1, horizon:int=14, freq:str='D', name:str='Daily', n_ts:int=4227)
来源
周
Weekly (seasonality:int=1, horizon:int=13, freq:str='W', name:str='Weekly', n_ts:int=359)
来源
月
Monthly (seasonality:int=12, horizon:int=18, freq:str='M', name:str='Monthly', n_ts:int=48000)
来源
季
Quarterly (seasonality:int=4, horizon:int=8, freq:str='Q', name:str='Quarterly', n_ts:int=24000)
来源
年
Yearly (seasonality:int=1, horizon:int=6, freq:str='Y', name:str='Yearly', n_ts:int=23000)
数据下载类
来源
M4
M4 (source_url:str='https://raw.githubusercontent.com/Mcompetitions/M4- methods/master/Dataset/', naive2_forecast_url:str='https://github.com /Nixtla/m4-forecasts/raw/master/forecasts/submission-Naive2.zip')
group = 'Hourly'
await M4.async_download('data', group=group)
df, *_ = M4.load(directory='data', group=group)
n_series = len(np.unique(df.unique_id.values))
display_str = f'Group: {group} '
display_str += f'n_series: {n_series}'
print(display_str)
评估类
来源
M4Evaluation
M4Evaluation ()
初始化 self。有关准确的签名,请参阅 help(type(self))。
基于 URL 的评估
类 M4Evaluation
中的 evaluate
方法可以接收上传到 M4 竞赛的 基准 的 URL。
与即时评估结果相比,这些结果来自 官方评估。
from fastcore.test import test_close
esrnn_url = 'https://github.com/Nixtla/m4-forecasts/raw/master/forecasts/submission-118.zip'
esrnn_evaluation = M4Evaluation.evaluate('data', 'Hourly', esrnn_url)
# Test of the same evaluation as the original one
test_close(esrnn_evaluation['SMAPE'].item(), 9.328, eps=1e-3)
test_close(esrnn_evaluation['MASE'].item(), 0.893, eps=1e-3)
test_close(esrnn_evaluation['OWA'].item(), 0.440, eps=1e-3)
esrnn_evaluation
基于 Numpy 的评估
evaluate
方法也可以接收一个预测结果的 numpy 数组。
fforma_url = 'https://github.com/Nixtla/m4-forecasts/raw/master/forecasts/submission-245.zip'
fforma_forecasts = M4Evaluation.load_benchmark('data', 'Hourly', fforma_url)
fforma_evaluation = M4Evaluation.evaluate('data', 'Hourly', fforma_forecasts)
# Test of the same evaluation as the original one
test_close(fforma_evaluation['SMAPE'].item(), 11.506, eps=1e-3)
test_close(fforma_evaluation['MASE'].item(), 0.819, eps=1e-3)
test_close(fforma_evaluation['OWA'].item(), 0.484, eps=1e-3)
fforma_evaluation
助手
响应由 AI 生成,可能包含错误。