开始使用免费开始使用

Transforming backtesting output

Once backtesting is complete, you will need to transform the data in order to effectively evaluate the results and choose the best-performing model.

本练习是课程的一部分

Designing Forecasting Pipelines for Production

查看课程

交互式实操练习

通过完成这段示例代码来试试这个练习。

models = list(ml_models.keys())  

bkt_long = pd.melt(
    bkt_df,
    id_vars=["unique_id", "ds", "cutoff", "y"],
  	# Complete two f-strings
    value_vars=models + [f"{____}-lo-95" for model in models] + [f"{____}-hi-95" for model in models],
    var_name="model_label", 
    value_name="value")

print(bkt_long.head())
编辑并运行代码