plots.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:cauldron-gallery 作者: sernst 项目源码 文件源码
def create_arima_plot(
        df_history: pd.DataFrame,
        model_data: arima.MODEL_DATA
) -> Figure:
    """
    Plot the fitting data for the specified model

    :param df_history:
        The historical data that was fitted by the ARIMA model
    :param model_data:
        The MODEL_DATA instance to plot
    """

    results = model_data.results

    figure = Figure()
    figure.xaxis.axis_label = 'Year'
    figure.yaxis.axis_label = 'Temperature (Celsius)'

    df = df_history.sort_values(by='order')
    order = df['order']
    add_to_arima_plot(
        figure,
        order,
        df['temperature'].values,
        'Data',
        'blue'
    )

    add_to_arima_plot(
        figure,
        order,
        results.fittedvalues,
        'Model',
        'red'
    )

    figure.title = '({p}, {d}, {q}) RMSE: {rmse:0.4f}'.format(
        **model_data._asdict()
    )

    figure.legend.location = 'bottom_left'

    return figure
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号