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
[ENH] NeuralForecastRNN
should auto-detect freq
#6003
Comments
FYI @yarnabrina |
I replied to your comment in the PR, but I think it got lost in later conversations. I'm not sure if I understand how to use |
As a consequence, once Therefore, trying to get In consequence, a sensible |
Enhances `NeuralForecastRNN` to interpret `freq` from `ForecastingHorizon` when passed as `"auto"`
Enhances `NeuralForecastRNN` to interpret `freq` from `ForecastingHorizon` when passed as `"auto"` <!-- Welcome to sktime, and thanks for contributing! Please have a look at our contribution guide: https://www.sktime.net/en/latest/get_involved/contributing.html --> #### Reference Issues/PRs <!-- Example: Fixes #1234. See also #3456. Please use keywords (e.g., Fixes) to create link to the issues or pull requests you resolved, so that they will automatically be closed when your pull request is merged. See https://github.com/blog/1506-closing-issues-via-pull-requests. If no issue exists, you can open one here: https://github.com/sktime/sktime/issues --> Fixes #6003. #### What does this implement/fix? Explain your changes. <!-- A clear and concise description of what you have implemented. --> The `NeuralForecastRNN` constructor previously required a `freq` argument, which is now proposed to default to `"auto"` in which case it interprets `freq` from `ForecastingHorizon`, leveraging `fh.freq` in the `fit` method. #### What should a reviewer concentrate their feedback on? <!-- This section is particularly useful if you have a pull request that is still in development. You can guide the reviews to focus on the parts that are ready for their comments. We suggest using bullets (indicated by * or -) and filled checkboxes [x] here --> I have run the tests with the updated estimator ```py results = check_estimator(NeuralForecastRNN) # All tests PASSED! ``` `freq` can now be passed like this: ```py y, X = load_longley() y_train, y_test, X_train, X_test = temporal_train_test_split(y, X, test_size=4) model = NeuralForecastRNN( "auto", # interprets to be "A-DEC" futr_exog_list=["ARMED", "POP"], max_steps=5) model.fit(y_train, X=X_train, fh=[1, 2, 3, 4]) model.predict(X=X_test) # Seed set to 1 # 1959 66241.984375 # 1960 66700.132812 # 1961 66550.195312 # 1962 67310.007812 # Freq: A-DEC, Name: TOTEMP, dtype: float64 ```
Right now, a
freq
argument needs to be passed to the constructor ofNeuralForecastRNN
, and it will raise exception if not.To my understanding, this must always be identical with the
freq
of the data (aspandas
coerced),Therefore, this information is available in
fit
, so why not have a default setting of"auto"
, in which casefh.freq
is used? This would also be deprecation safe, as an arg without default would get one.The text was updated successfully, but these errors were encountered: