neural_prophet icon indicating copy to clipboard operation
neural_prophet copied to clipboard

'TimeNet' object has no attribute 'ar_weights' in model.fit() when n_lags is not set but ar_reg is set

Open akosmaroy opened this issue 10 months ago • 0 comments

Prerequisites

  • [X] Put an X between the brackets on this line if you have done all of the following:
    • [X] Reproduced the problem in a new virtualenv with only neuralprophet installed, directly from github:
      git clone <copied link from github>
      cd neural_prophet
      pip install .
      
    • [X] Checked the Answered Questions on the Github Discussion board: https://github.com/ourownstory/neural_prophet/discussions If you have the same question but the Answer does not solve your issue, please continue the conversation there.
    • [X] Checked that your issue isn't already filed: https://github.com/ourownstory/neural_prophet/issues If you have the same issue but there is a twist to your situation, please add an explanation there.
    • [X] Considered whether your bug might actually be solvable by getting a question answered:

Describe the bug

I'm getting the following exception when calling model.fit():

'TimeNet' object has no attribute 'ar_weights'

To Reproduce

Create a NeuralProphet object with the following parameters:

        prophet_parameters = {
            # 'n_lags': 79,   <- this parameter is not set
            'ar_reg': 0.08971683614862916,   # <- this parameter is set
            'ar_layers': [116, 116, 116, 116, 116, 116],  # <- AR related parameter, but doesn't have an impact on the exception
            # the rest probably is not relevant to this bug
            'daily_seasonality': False,
            'weekly_seasonality': 'auto',
            'yearly_seasonality': 'auto',
            'accelerator': 'auto',
            'collect_metrics': ["MSE", "MAE", "RMSE"],
            'quantiles': quantiles,
            'n_forecasts': 2,
            'lagged_reg_layers': [82, 82], 
            'trend_reg': 0.9706135322078026,
            'n_changepoints': 91,
            'seasonality_mode': 'multiplicative',
            'seasonality_reg': 0.7543763277837088,
            'future_regressors_model': 'linear',
            'learning_rate': 1e-3,
        }

And call model.fit(). The exception is not thrown immediately, in this case it's thrown at epoch 67. Setting the 'n_lags': parameter makes it not throw the exception, as does removing both 'n_lags' and 'ar_reg'

The fact that the exception is thrown so late, e.g. on epoch 67 - implies that the model internal structure changes between epochs?

Expected behavior

model.fit() should not through this exception.

What actually happens

An exception with the following message is thrown:

'TimeNet' object has no attribute 'ar_weights'

Screenshots

n/a

Environment (please complete the following information):

Python 3.10.12 Ubuntu 22.04 in WSL on Windows 11 NeuralProphet installed from github latest, 23543560b4ed278e84d1fd0f119d332342336d0d

Additional context

n/a

akosmaroy avatar Apr 04 '24 21:04 akosmaroy