在Facebook Prophet模型Python上仅绘制预测值

问题描述

当我通过以下代码使用Facebook先知模型进行绘图时:

number_of_days_in_future = 20
future = m.make_future_dataframe(periods=number_of_days_in_future,freq="D") 
weekend = future[future['ds'].dt.dayofweek < 5  ]
prediction = m.predict(weekend)
m.plot(prediction)
plt.title("Prediction of Value")
plt.xlabel("Date")
plt.ylabel("Value")
plt.show()

它显示了从历史数据开始的绘图,如下所示:

Plotted

由于该图的Y轴范围较大,因此很难从图中理解该值。

但是,如果我只预测几天。像这样从Y轴更容易理解值:

enter image description here

我的问题是:

  1. 有没有办法使它不会跨越这么大的范围? (如果我们可以忽略绘制阴影部分的话)
  2. 有什么方法可以绘制预测的尾部吗? (我不想绘制整个历史数据)

解决方法

我刚刚从fbprophet存储库中找到了一种满足我要求的方法。

import java.util.Scanner;
public class ternary_operator {     
            
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in).useDelimiter("\r?\n");               
        
        int i = 100;
        int j = 200;
        String light;
        String heavy;
        light = (" You are light");
        heavy= ("You are heavy");
        System.out.println("How much do you weigh? 100 or 200 ?"); 
        
        s = s.nextInt();
         
        s =  i==i?light:heavy;
         
        System.out.println(s);      
    }    
}

该图变得更加清晰: enter image description here

,

要忽略阴影部分,请将 'uncertainty' 绘图参数归因于 'False'。

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...