How to construct Kolmogorov-Arnold Network based on MATLAB's Deep Learning Toolbox

Kolmogorov-Arnold Networks (KANs) are theoretically grounded alternatives to conventional Multilayer Perceptrons (MLPs). KANs are built upon the Kolmogorov-Arnold representation theorem, a profound mathematical result stating that any multivariate continuous function can be expressed through a finite composition of univariate continuous functions and binary additions. This theoretical guarantee takes concrete form in the equation:
where and are univariate continuous functions. The structure corresponds to a two-layer network: the first layer applies the inner functions , while the second layer applies the outer functions , with layer widths n and , respectively. Each univariate function using B-spline curves with learnable coefficients.
This leads to a fundamentally different network architecture compared to MLPs. As illustrated in the following figure, traditional MLPs apply fixed nonlinear activations to weighted sums at each node, with learning concentrated in edge weights. In contrast, KANs invert this paradigm: nodes perform simple summations, and the learning occurs on the edges, where each connection is associated with a trainable B-spline activation function.
Can anyone has some advices about how to construct this KAN using Deep Learning Toolbox ?

 Accepted Answer

After referring to the open-source Github repository pykan, I have successfully implemented a custom KAN layer based on MATLAB's Deep Learning Toolbox and the Define Custom Deep Learning Layer with Learnable Parameters Example. The custom KAN layer accepts a "CB" dlarray and returns a "CB" dlarray.
>> checkLayer(kanLayer,layout)
Skipping code generation compatibility tests. To check validity of the layer for code generation, specify the CheckCodegenCompatibility and ObservationDimension options.
Running nnet.checklayer.TestLayerWithoutBackward
.......... .......... ........
Done nnet.checklayer.TestLayerWithoutBackward
__________
Test Summary:
28 Passed, 0 Failed, 0 Incomplete, 6 Skipped.
Time elapsed: 0.35918 seconds.

7 Comments

Hello, would you be kind enough to share the script? Thank you
@Imola Fodor. I am preparing to submit the relevant scripts to File Exchange, the related files will be presented in the File Exchange.
Sounds good, now you know there is interest in the implementation :)
Not working.
File: KANLayer.m Line: 43 Column: 24
Function argument definition error in KANLayer constructor. Unknown function argument attribute 'Input'.
@José. Thanks for pointing out the issue. Currently, I can not access the File Exchange due to the Access Denied error.
Access Denied
You don't have permission to access "http://ww2.mathworks.cn/matlabcentral/fileexchange/183210-kan-layer-based-on-matlab-deep-learning-toolbox" on this server.
Reference #18.b70ae07a.1773281121.14356e19
https://errors.edgesuite.net/18.b70ae07a.1773281121.14356e19

Sign in to comment.

More Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Products

Release

R2025a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!