We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Trying to do something similar to the Transfer learning tutorial: https://nixtla.github.io/neuralforecast/examples/transfer_learning.html Setting save_dataset=False as in the tutorial
save_dataset=False
With this code
# Fit model nf_ts = NeuralForecast(models=models, freq="D") nf_ts.fit(df=Y_train_df_ts) # Save model nf_ts.save(path='./models/ts/', model_index=None, overwrite=True, save_dataset=False) # save_dataset=False !!! # Reload model nf_ts = NeuralForecast.load(path='./models/ts/') # Predict Y_hat_df_ts = nf_ts.predict(df=Y_train_df_ts, futr_df=futr_df)
I get this error
File /opt/conda/lib/python3.10/site-packages/neuralforecast/core.py:340, in NeuralForecast.predict(self, df, static_df, futr_df, sort_df, verbose, **data_kwargs) 336 if df is not None: 337 dataset, uids, last_dates, _ = self._prepare_fit( 338 df=df, static_df=static_df, sort_df=sort_df, scaler_type=None 339 ) --> 340 dataset.scalers_ = self.dataset.scalers_ 341 dataset._transform_temporal() 342 else: AttributeError: 'NeuralForecast' object has no attribute 'dataset'
neuralforecast main branch Python 3.10 GNU/Linux
import pandas as pd from datasetsforecast.m4 import M4 from neuralforecast.core import NeuralForecast from neuralforecast.models import NHITS from neuralforecast.utils import AirPassengersDF Y_df, _, _ = M4.load(directory='./', group='Monthly', cache=True) Y_df['ds'] = pd.to_datetime(Y_df['ds']) Y_df horizon = 12 stacks = 3 models = [NHITS(input_size=5 * horizon, h=horizon, max_steps=100, stack_types = stacks*['identity'], n_blocks = stacks*[1], mlp_units = [[256,256] for _ in range(stacks)], n_pool_kernel_size = stacks*[1], batch_size = 32, scaler_type='standard', n_freq_downsample=[12,4,1])] nf = NeuralForecast(models=models, freq='M') nf.fit(df=Y_df) nf.save(path='./results/transfer/', model_index=None, overwrite=True, save_dataset=False) nf = NeuralForecast.load(path='./results/transfer/') Y_df = AirPassengersDF.copy() mean = Y_df[Y_df.ds<='1959-12-31']['y'].mean() std = Y_df[Y_df.ds<='1959-12-31']['y'].std() Y_train_df = Y_df[Y_df.ds<='1959-12-31'] # 132 train Y_test_df = Y_df[Y_df.ds>'1959-12-31'] # 12 test Y_hat_df = nf.predict(df=Y_train_df).reset_index()
None
The text was updated successfully, but these errors were encountered:
I see it's a duplicate of #798
Sorry, something went wrong.
No branches or pull requests
What happened + What you expected to happen
Trying to do something similar to the Transfer learning tutorial: https://nixtla.github.io/neuralforecast/examples/transfer_learning.html
Setting
save_dataset=False
as in the tutorialWith this code
I get this error
Versions / Dependencies
neuralforecast main branch
Python 3.10
GNU/Linux
Reproduction script
Issue Severity
None
The text was updated successfully, but these errors were encountered: