Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alias function plot_last_forecast() for plot_latest_forecast() and give deprecation warning #919

Merged
merged 11 commits into from
Nov 21, 2022
19 changes: 19 additions & 0 deletions neuralprophet/forecaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -1716,6 +1716,25 @@ def plot_latest_forecast(
line_per_origin=True,
)

def plot_last_forecast(
self,
fcst,
df_name=None,
ax=None,
xlabel="ds",
ylabel="y",
figsize=(10, 6),
include_previous_forecasts=0,
plot_history_data=None,
plotting_backend="default",
):
args = locals()
log.warning(
"plot_last_forecast() has been renamed to plot_latest_forecast() and is therefore deprecated. "
"Please use plot_latst_forecast() in the future"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Please use plot_latest_forecast()* in the future"

)
return NeuralProphet.plot_latest_forecast(**args)

def plot_components(
self, fcst, df_name="__df__", figsize=None, forecast_in_focus=None, residuals=False, plotting_backend="default"
):
Expand Down
1 change: 1 addition & 0 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ def test_plot():
forecast = m.predict(future)
m.plot(forecast)
m.plot_latest_forecast(forecast, include_previous_forecasts=10)
m.plot_last_forecast(fcst=forecast, include_previous_forecasts=10) # test deprecated alias
m.plot_components(forecast)
m.plot_parameters()
log.info("testing: Plotting with quants")
Expand Down