KindXiaoming / pykan

Kolmogorov Arnold Networks
MIT License
14.24k stars 1.3k forks source link

Trouble Replotting Symbolically Fixed Spline from Equation #339

Open HAvlani opened 1 month ago

HAvlani commented 1 month ago

Hi,

After training my model, I was left with a learned spline on one of the edges (attached in black). After symbolically fixing this spline to a Gaussian, the spline slightly changed (attached in red). Then, to get the equation associated with only this spline, I symbolically fixed every other spline to be linear. The relevant part of the resulting equation was $\displaystyle - 121.91 e^{- 0.17 \left(0.66 - x_{14}\right)^{2}}$. However, when graphing this equation (also attached), I get a graph that looks nothing like the spline. What am I missing here?

Thanks, Harshil spline symobl

Screenshot 2024-07-14 at 3 06 20 PM
KindXiaoming commented 1 month ago

coould you please elaborate more on: (1) how many input dimnesions; (2) KAN shape; (3) which activation is set Gaussian while others linear?

HAvlani commented 1 month ago

There are 14 features, and the model has a single hidden layer of 3 ([14,3,1]). I have set the rightmost activation in the first node as Gaussian ([0,13,2]).

I've attached the model plot, and here is the full equation: $\displaystyle 60.33 x{1} + 82.58 x{10} + 1.16 x{11} + 259.19 x{12} - 173.8 x{13} - 31.97 x{14} + 117.29 x{2} + 57.97 x{3} + 21.78 x{4} - 67.13 x{5} - 142.17 x{6} - 57.51 x{7} - 116.25 x{8} - 42.3 x{9} + 967.58 - 121.91 e^{- 0.17 \left(0.66 - x_{14}\right)^{2}}$

Thank you for your help. output

KindXiaoming commented 1 month ago

what're the x & y axes in your last plot?

HAvlani commented 1 month ago

Sorry about that. Here's a better view of that plot.

Screenshot 2024-07-15 at 3 44 58 PM