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

KAN feels hard to learn "Addition" #80

Closed
ycq091044 opened this issue May 5, 2024 · 4 comments
Closed

KAN feels hard to learn "Addition" #80

ycq091044 opened this issue May 5, 2024 · 4 comments

Comments

@ycq091044
Copy link

ycq091044 commented May 5, 2024

Hello, thanks for the interesting method. I have a fail trial and need some help here.

Using the hellokan.ipynb template, I changed the complex formula into "Addition". With all other parts fixed, it seems the model training loss does not go down and cannot discovers the "Addition" operation.

image image image
@Flecart
Copy link

Flecart commented May 5, 2024

I think you should do as in hellokan you should prune the model, then retrain it, and prune it, until you can't prune it anymore

@KindXiaoming
Copy link
Owner

KindXiaoming commented May 5, 2024

Hi Sorry, the API can be a bit confusing, but instead of

f = lambda x: x[:,0] + x[:,1]

it should be

f = lambda x: x[:,[0]] + x[:,[1]]

instead. If that's still not working, try reduce lamb. Let me know how this goes!

@CoryKornowicz
Copy link

I was also a bit confused about the definition of that lambda, and I redefined it locally as
f = lambda x: x[:, 0, np.newaxis] + x[:, 1, np.newaxis]
to make the return dimension more explicit. You can also replace np.newaxis with None and the effect is the same.

@ycq091044
Copy link
Author

Thanks, change into f = lambda x: x[:,[0]] + x[:,[1]] works.

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

4 participants