Core Module Documentation¶
- neuralprophet.plot_forecast.plot(fcst, ax=None, xlabel='ds', ylabel='y', highlight_forecast=None, line_per_origin=False, figsize=(10, 6))¶
Plot the NeuralProphet forecast
- Parameters
fcst (pd.DataFrame) – Output of m.predict
ax (matplotlib axes) – Axes to plot on
xlabel (str) – Label name on X-axis
ylabel (str) – Label name on Y-axis
highlight_forecast (int) – i-th step ahead forecast to highlight.
line_per_origin (bool) – Print a line per forecast of one per forecast age
figsize (tuple) – Width, height in inches.
- Returns
Figure showing the NeuralProphet forecast
Examples
Base usage
>>> from neuralprophet import NeuralProphet >>> m = NeuralProphet() >>> metrics = m.fit(df, freq="D") >>> future = m.make_future_dataframe(df=df, periods=365) >>> forecast = m.predict(df=future) >>> fig_forecast = m.plot(forecast)
Additional plot specifications
>>> fig_forecast = m.plot(forecast, >>> xlabel="ds", >>> ylabel="y", >>> highlight_forecast=None, >>> line_per_origin=False, >>> figsize=(10, 6) >>> )
- Return type
matplotlib.pyplot.figure
- neuralprophet.plot_forecast.plot_components(m, fcst, forecast_in_focus=None, one_period_per_season=True, residuals=False, figsize=None)¶
Plot the NeuralProphet forecast components.
- Parameters
m (NeuralProphet) – Fitted model
fcst (pd.DataFrame) – Output of m.predict
forecast_in_focus (int) – n-th step ahead forecast AR-coefficients to plot
one_period_per_season (bool) – Plot one period per season, instead of the true seasonal components of the forecast.
figsize (tuple) –
Width, height in inches.
Note
Default value is set to
None
-> automaticfigsize = (10, 3 * npanel)
- Returns
Figure showing the NeuralProphet forecast components
- Return type
matplotlib.pyplot.figure
- neuralprophet.plot_forecast.plot_forecast_component(fcst, comp_name, plot_name=None, ax=None, figsize=(10, 6), multiplicative=False, bar=False, rolling=None, add_x=False)¶
Plot a particular component of the forecast.
- Parameters
fcst (pd.DataFrame) – Output of m.predict
comp_name (str) – Name of the component to plot
plot_name (str) – Name of the plot Title
ax (matplotlib axis) – Matplotlib Axes to plot on
figsize (tuple) –
Width, height in inches. Ignored if ax is not None
Note
Default value is set to
figsize = (10, 6)
multiplicative (bool) – Set y axis as percentage
bar (bool) – Make barplot
rolling (int) – Rolling average underplot
add_x (bool) – Add x symbols to plotted points
- Returns
List of Artist objects containing a particular forecast component
- Return type
matplotlib.artist.Artist
- neuralprophet.plot_forecast.plot_multiforecast_component(fcst, comp_name, plot_name=None, ax=None, figsize=(10, 6), multiplicative=False, bar=False, focus=1, num_overplot=None)¶
Plot a particular component of the forecast.
- Parameters
fcst (pd.DataFrame) – Output of m.predict.
comp_name (str) – Name of the component to plot.
plot_name (str) – Name of the plot Title.
ax (matplotlib axis) – Matplotlib Axes to plot on.
figsize (tuple) –
Width, height in inches, ignored if ax is not None.
Note
Default value is set to
figsize = (10, 6)
multiplicative (bool) – Set y axis as percentage
bar (bool) – Make barplot
focus (int) – Forecast number to portray in detail.
num_overplot (int) –
Overplot all forecasts up to num
Note
Default value is set to
num_overplot = None
-> only plot focus
- Returns
List of Artist objects containing a particular forecast component
- Return type
matplotlib.artist.Artist