pykan icon indicating copy to clipboard operation
pykan copied to clipboard

Q: How to get a specific activation function's equation?

Open GorkaAbad opened this issue 9 months ago • 1 comments

Hi,

for a trained model, is there any way to get the equation that defines the activation function (spline) for some specific connection?

Since we can get the plots, I would like to get the equation also, e.g., f(x) = ax +b for some linear activation functions, including a and b values.

Best,

GorkaAbad avatar May 15 '24 15:05 GorkaAbad

This might be useful: https://kindxiaoming.github.io/pykan/API_demo/API_4_extract_activations.html

Also, function names are stored in model.symbolic_fun[l].funs_name and coefficients are stored in model.symbolic_fun[l].affine (l is the layer index)

KindXiaoming avatar May 15 '24 19:05 KindXiaoming

Hi @KindXiaoming, Many thanks and congratulations on this amazing work. Following up on this, I have been trying to understand the architecture of the network and I want to report an inconsistency (to the best of my understanding) between the paper and the implementation. Please look at the screenshot from the paper below: image However, this is inconsistent with the implementation where a bias term is added to the summation of all outputs from the previous layer to represent the input to the next layer. Here is a screenshot from the code: image

I hope this helps.

Best wishes, Tanuj

tk3016 avatar Jun 06 '24 09:06 tk3016

hi, thank you for reporting this. yes, in the code the bias term is by default included, but I did not write them out since it can be absorbed into any activation functions. Bias terms are needed for sparsity regularization (without them, regularization seem to behave weird. But maybe there is a better way).

KindXiaoming avatar Jun 06 '24 12:06 KindXiaoming