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

about dataset input value #263

Closed
kaneyxx opened this issue Jun 8, 2024 · 4 comments
Closed

about dataset input value #263

kaneyxx opened this issue Jun 8, 2024 · 4 comments

Comments

@kaneyxx
Copy link

kaneyxx commented Jun 8, 2024

Hi, I noticed that your example dataset and default grid range are within the range of [-1, 1]. Should we always try to normalize input value to that range or model will handle by itself?

E.g., Now I have 3 input variables of which range are different. They are [-5, 5] [-4, 4] [-1, 1], I don't know how to initialize the spline grid_eps and grid_range.

@KindXiaoming
Copy link
Owner

KindXiaoming commented Jun 10, 2024

Hi, update_grid_from_samples handles that. if you use the train method, it calls update_grid_from_samples every few steps so any ranges should be handled automatically. With that being said, it's still advisible to normalize your data to O(1), although not necessarily strictly in [-1,1].

@kaneyxx
Copy link
Author

kaneyxx commented Jun 10, 2024

Thanks for kindly answering.
After training some steps, I suppose that the model has updated grid several times. Is it possible to know current grid range? If yes, does it mean that I don't need update grid manually?
Or, if I want to update the grid by myself, is it the best way to turn off that update grid argument?

@KindXiaoming
Copy link
Owner

KindXiaoming commented Jun 10, 2024

Yes, it is possible to know current grid range by calling model.act_fun[0].grid, for later layers, use model.act_fun[l].grid with l=1,2,.... Yes, it means you don't need to update grid manually. If you are still worrying about this, you can check grids right after initializing the model and after training.

Yes, if you want to update the grid by yourself, you could simply set train(...., update_grid=False) and call update_grid_from_samples by yourself.

@kaneyxx
Copy link
Author

kaneyxx commented Jun 10, 2024

Thank you! This is very helpful for understanding the implementations. I'm applying KAN to my domain to see if I can rediscover the same formula. Interpretability is what I have been concerned about for a long time. Thanks again for this great work!

@kaneyxx kaneyxx closed this as completed Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants