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

[ENH] pykan based forecaster #6386

Merged
merged 9 commits into from May 23, 2024
Merged

[ENH] pykan based forecaster #6386

merged 9 commits into from May 23, 2024

Conversation

benHeid
Copy link
Contributor

@benHeid benHeid commented May 3, 2024

Towards #6390

from sktime.forecasting.pykan_forecaster import PyKANForecaster
from sktime.datasets import load_airline
forecaster = PyKANForecaster()
forecaster.fit(load_airline(), fh=range(12))
prediction = forecaster.predict()
import matplotlib.pyplot as plt
plt.plot(prediction.detach().numpy().flatten(), label="Prediction")
plt.plot(test_target[0].detach().numpy().flatten(), label="True")
plt.show()

Reference Issues/PRs

#6390

What does this implement/fix? Explain your changes.

Add a simple PyKAN based forecaster

Does your contribution introduce a new dependency? If yes, which one?

pykan

What should a reviewer concentrate their feedback on?

Did you add any tests for the change?

add get_test_params

Any other comments?

PR checklist

For all contributions
  • I've added myself to the list of contributors with any new badges I've earned :-)
    How to: add yourself to the all-contributors file in the sktime root directory (not the CONTRIBUTORS.md). Common badges: code - fixing a bug, or adding code logic. doc - writing or improving documentation or docstrings. bug - reporting or diagnosing a bug (get this plus code if you also fixed the bug in the PR).maintenance - CI, test framework, release.
    See here for full badge reference
  • Optionally, for added estimators: I've added myself and possibly to the maintainers tag - do this if you want to become the owner or maintainer of an estimator you added.
    See here for further details on the algorithm maintainer role.
  • The PR title starts with either [ENH], [MNT], [DOC], or [BUG]. [BUG] - bugfix, [MNT] - CI, test framework, [ENH] - adding or improving code, [DOC] - writing or improving documentation or docstrings.
For new estimators
  • I've added the estimator to the API reference - in docs/source/api_reference/taskname.rst, follow the pattern.
  • I've added one or more illustrative usage examples to the docstring, in a pydocstyle compliant Examples section.
  • If the estimator relies on a soft dependency, I've set the python_dependencies tag and ensured
    dependency isolation, see the estimator dependencies guide.

@fkiraly fkiraly added implementing algorithms Implementing algorithms, estimators, objects native to sktime interfacing algorithms Interfacing existing algorithms/estimators from third party packages module:forecasting forecasting module: forecasting, incl probabilistic and hierarchical forecasting enhancement Adding new functionality labels May 4, 2024
@benHeid
Copy link
Contributor Author

benHeid commented May 5, 2024

TODOs

  • Try to expose all available parameters of the KAN and the train methods using dicts.

@benHeid benHeid marked this pull request as ready for review May 10, 2024 14:17
@narencastellon
Copy link

How do I install from sktime.forecasting.pykan_forecaster import PyKANForecaster, what is the dependency to install?

@benHeid
Copy link
Contributor Author

benHeid commented May 18, 2024

Hey, it is not on the main branch yet. You need to install the feature branch. E.g. by cloning the repo check out the feature branch and install this branch.

Hopefully, this feature is included in the next sktime release.
@fkiraly fyi.

@fkiraly
Copy link
Collaborator

fkiraly commented May 20, 2024

let me know when it's ready to review - currently there is one unchecked todo

@benHeid
Copy link
Contributor Author

benHeid commented May 21, 2024

let me know when it's ready to review - currently there is one unchecked todo

Sorry, I forgot to tick the open todo. I enabled the parameter using two dicts: model_params and fit_params

fkiraly
fkiraly previously approved these changes May 22, 2024
Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems done, then.

Have you solved the test time issue?

@narencastellon
Copy link

Thank you very much @fkiraly Franz Király excellent work,, I'm going to try it. a query to perform some tests I must clone the repository, and then I can call the function like this: from sktime.forecasting.pykan_forecaster import PyKANForecaster

@fkiraly
Copy link
Collaborator

fkiraly commented May 22, 2024

@narencastellon, this is actually almost entirely @benHeid's work!

To use this, you can simply wait for the release 0.29.1 in a few days, I would assume it is by then merged.

@benHeid
Copy link
Contributor Author

benHeid commented May 22, 2024

Seems done, then.

Have you solved the test time issue?

Not checked it directly, but due to the set test params and rather small test time series I haven't experienced any long test runs. Furthermore, also the CI forecasting runs are not reporting this forecaster as slowest.
However, I can check tomorrow locally.

@benHeid
Copy link
Contributor Author

benHeid commented May 23, 2024

I compared it with the cINNForecaster. After reducing the network size of the test network it is now a bit faster than the cINNForecaster.

@fkiraly fkiraly merged commit d2ee973 into main May 23, 2024
141 of 202 checks passed
@fkiraly fkiraly deleted the pykan_forecaster branch May 23, 2024 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adding new functionality implementing algorithms Implementing algorithms, estimators, objects native to sktime interfacing algorithms Interfacing existing algorithms/estimators from third party packages module:forecasting forecasting module: forecasting, incl probabilistic and hierarchical forecasting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants