您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

在python中使用Prophet预测每个类别的值

在python中使用Prophet预测每个类别的值

分隔数据框articletype,然后尝试将所有预测值存储在字典中

def get_prediction(df):
    prediction = {}
    df = df.rename(columns={'Date of the document': 'ds','Quantity sold': 'y', 'Article bar code': 'article'})
    list_articles = df2.article.unique()

    for article in list_articles:
        article_df = df2.loc[df2['article'] == article]
        # set the uncertainty interval to 95% (the Prophet default is 80%)
        my_model = Prophet(weekly_seasonality= True, daily_seasonality=True,seasonality_prior_scale=1.0)
        my_model.fit(article_df)
        future_dates = my_model.make_future_dataframe(periods=6, freq='MS')
        forecast = my_model.predict(future_dates)
        prediction[article] = forecast
    return prediction

现在,该预测将具有每种文章的预测。

python 2022/1/1 18:37:14 有380人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶