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

null prediction when using future regressor and len(training set) == n_lags + n_forecasts #1567

Open
1 task done
adi250491 opened this issue Apr 23, 2024 · 0 comments
Open
1 task done

Comments

@adi250491
Copy link

Prerequisites

Describe the bug

When using future regressor, and the training dataset length is exaclty equal to n_lags + n_forecasts, the model.predict methods returns a prediction dataframe with null values on all yhat columns.

The same training data works when future regressor is not used.

Please run the included code to reproduce the error.

To Reproduce

Steps to reproduce the behavior:

import pandas as pd
import numpy as np
import neuralprophet
demo_df = pd.DataFrame(
   {
    "ds": pd.date_range("2022-04-01", "2022-04-30"),
   "y": np.random.random(30),
   "reg": np.random.random(30),
   })

demo_model = neuralprophet.NeuralProphet(n_forecasts=15, n_lags=15)
demo_model.set_plotting_backend('matplotlib')
demo_model.add_future_regressor("reg")
demo_model.fit(demo_df)
prediction = demo_model.predict(demo_df) #<== THIS IS THE BLANK DATAFRAME
demo_model.plot(prediction) 


demo_model2 = neuralprophet.NeuralProphet(n_forecasts=15, n_lags=15)
demo_model2.set_plotting_backend('matplotlib')
# demo_model.add_future_regressor("reg")
demo_model2.fit(demo_df[['ds','y']])
prediction2 = demo_model2.predict(demo_df[['ds','y']])  #<== THIS IS THE EXPECTED BEAHVIOUR
demo_model2.plot(prediction2)

Expected behavior
The model.predict method should return a dataframe with predicted values for the n_forecasts dates

What actually happens
The model.predict method returns a dataframe with null values in all yhat columns

Environment (please complete the following information):

  • Python environment Python: 3.11.9, venv
  • NeuralProphet version and install method: v0.8.0 installed from PYPI with pip install neuralprophet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant