Skip to main content

CVKAN: Complex-Valued Kolmogorov-Arnold Networks

Project description

CVKAN: Complex-Valued Kolmogorov-Arnold Networks

Authors: Matthias Wolff, Florian Eilers, Xiaoyi Jiang
University of Münster, Department of Computer Science

Conference Paper: M. Wolff, F. Eilers and X. Jiang, "CVKAN: Complex-Valued Kolmogorov-Arnold Networks," 2025 International Joint Conference on Neural Networks (IJCNN), Rome, Italy, 2025, pp. 1-9, doi: 10.1109/IJCNN64981.2025.11227425

Available on IEEEXplore: https://ieeexplore.ieee.org/document/11227425

Link to arXiv Paper: https://arxiv.org/abs/2502.02417


Abstract

In this work we propose CVKAN, a complex-valued Kolmogorov-Arnold Network (KAN), to join the intrinsic interpretability of KANs and the advantages of Complex-Valued Neural Networks (CVNNs). We show how to transfer a KAN and the necessary associated mechanisms into the complex domain. To confirm that CVKAN meets expectations we conduct experiments on symbolic complex-valued function fitting and physically meaningful formulae as well as on a more realistic dataset from knot theory. Our proposed CVKAN is more stable and performs on par or better than real-valued KANs while requiring less parameters and a shallower network architecture, making it more explainable.

<CVKAN Plot>


Table of Contents


How to use

See demo.py

Install

pip install cvkan

Imports

from cvkan import CVKANWrapper, train_kans, KANPlot
from cvkan.models.CVKAN import Norms
from cvkan.utils import create_complex_dataset, CSVDataset
from cvkan.utils.loss_functions import MSE, MAE

Create Dataset

# Generate dataset for f(z)=(z1^2 + z2^2)^2
f_squaresquare = lambda x: (x[:,0]**2 + x[:,1]**2)**2
# create dataset (this is a dictionary with keys 'train_input', 'train_label', 'test_input' and 'test_label', each
# containing a Tensor as value)
dataset = create_complex_dataset(f=f_squaresquare, n_var=2, ranges=[-1,1], train_num=5000, test_num=1000)
# convert dataset to CSVDataset object for easier handling later
dataset = CSVDataset(dataset, input_vars=["z1", "z2"], output_vars=["(z1^2 + z2^2)^2"], categorical_vars=[])

CVKAN

# create CVKAN model. Note that this is CVKANWrapper, which is basically the same as CVKAN but with additional
# features for plotting later on
cvkan_model = CVKANWrapper(layers_hidden=[2,1,1], num_grids=8, use_norm=Norms.BatchNorm, grid_mins=-2, grid_maxs=2, csilu_type="complex_weight")



# train cvkan_model on dataset
results = train_kans(cvkan_model,  # model
           dataset,  # dataset
           loss_fn_backprop=MSE(),  # loss function to use for backpropagation
           loss_fns={"mse": MSE(), "mae": MAE()},  # loss function dictionary to evaluate the model on
           epochs=500,  # epochs to train for
           batch_size=1000,  # batch size for training
           kan_explainer=None,  # we could specify an explainer to make edge's transparency represent edge's relevance
           add_softmax_lastlayer=False,  # we don't need softmax after last layer (as we are doing regression)
           last_layer_output_real=False  # last layer should also have complex-valued output (regression)
           )
print("results of training: \n", results)

Plotting

# plot the model
kan_plotter = KANPlot(cvkan_model,
                      kan_explainer=None,
                      input_featurenames=dataset.input_varnames,
                      output_names=dataset.output_varnames,
                      complex_valued=True,
                      )
kan_plotter.plot_all()

In rare occasions the random initialization of the weights is suboptimal, which leads to the model not training correctly. If you do not end up with an image similar to the one displayed above or if the resulting Test MSE is way worse than 0.05, please run again.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cvkan-1.0.4.tar.gz (62.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cvkan-1.0.4-py3-none-any.whl (70.4 kB view details)

Uploaded Python 3

File details

Details for the file cvkan-1.0.4.tar.gz.

File metadata

  • Download URL: cvkan-1.0.4.tar.gz
  • Upload date:
  • Size: 62.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for cvkan-1.0.4.tar.gz
Algorithm Hash digest
SHA256 1e49cd2b70b1b1532599a0ba87d8e7cb92ffcdc42091bfacecb2e1fc3787845f
MD5 a33c9d699e10b57cb90b71de912036e0
BLAKE2b-256 1ef14f31ff5152d81ad586e47da2c76c6456e0927500cc5b62a9a38358aa229b

See more details on using hashes here.

File details

Details for the file cvkan-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: cvkan-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 70.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for cvkan-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 19b24b7dbd662e90e323817d2aa36a03e54c7bfbc11ca35f01939f2f497eaed0
MD5 6dd053842251c46525b25e3e6aa62f41
BLAKE2b-256 0bd9338704ca6de265218eabed4804ccbccdbbe43bc7ae2e18942f76770868ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page