Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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

Modelling NPTS model #899

Closed
parimuns opened this issue Jun 26, 2020 · 2 comments
Closed

Modelling NPTS model #899

parimuns opened this issue Jun 26, 2020 · 2 comments
Labels
question Further information is requested

Comments

@parimuns
Copy link

parimuns commented Jun 26, 2020

I am trying to model NPTS using Gluonts. Please guide me on how to get the probabilistic forecasting results using NPTSEstimator.

'from gluonts.model.npts import NPTSEstimator
from gluonts.trainer import Trainer
from gluonts.model.npts import NPTSPredictor
Predictor1=NPTSPredictor(freq='H', prediction_length=24, context_length= 48, kernel_type='exponential',use_seasonal_model= True, use_default_time_features = True)
predictor=Predictor1.predict(dataset=train_ds,num_samples=100)
test_ds = ListDataset([{FieldName.TARGET: target, 
                        FieldName.START: start,
                        FieldName.FEAT_DYNAMIC_REAL: [fdr],
                       } 
                       for (target, start,fdr) in zip(target, 
                                                            start, 
                                                            feat_dynamic_real, 
                                                            )],
                     freq=freq)
from gluonts.evaluation.backtest import make_evaluation_predictions
forecast_it, ts_it = make_evaluation_predictions(
    dataset=test_ds,  # test dataset
    predictor=predictor,  # predictor
    num_samples=100,  # number of sample paths we want for evaluation
)

I get error

AttributeError                       Traceback (most recent call last)
<ipython-input-25-c98cb60cf47a> in <module>
      3     dataset=test_ds,  # test dataset
      4     predictor=predictor,  # predictor
----> 5     num_samples=100,  # number of sample paths we want for evaluation
      6 )

c:\users\appdata\local\programs\python\python37\lib\site-packages\gluonts\evaluation\backtest.py in make_evaluation_predictions(dataset, predictor, num_samples)
     60     """
     61 
---> 62     prediction_length = predictor.prediction_length
     63     freq = predictor.freq
     64 

AttributeError: 'generator' object has no attribute 'prediction_length'
@parimuns parimuns added the question Further information is requested label Jun 26, 2020
@jaheba
Copy link
Contributor

jaheba commented Jun 29, 2020

You set predictor to Predictor1.predict(...). predict() returns an iterator over the predictions.

I think what you want is to pass Predictor1 to make_evaluation_predictions instead.

@parimuns
Copy link
Author

Got it.Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants