Skip to main content

Rational Kolmogorov-Arnold Network (rKAN)

Project description

Rational Kolmogorov-Arnold Network (rKAN)

Rational Kolmogorov-Arnold Network (rKAN) is a novel neural network that incorporates the distinctive attributes of Kolmogorov-Arnold Networks (KANs) with a trainable adaptive rational-orthogonal Jacobi function as its basis function. This method offers several advantages, including non-polynomial behavior, activity for both positive and negative input values, faster execution, and better accuracy.

Installation

To install rKAN, use the following command:

$ pip install rkan

Example Usage

The current implementation of rKAN works with both the TensorFlow and PyTorch APIs.

TensorFlow

from tensorflow import keras
from tensorflow.keras import layers
from rkan.tensorflow import JacobiRKAN, PadeRKAN

model = keras.Sequential(
    [
        layers.InputLayer(input_shape=input_shape),
        layers.Conv2D(32, kernel_size=(3, 3)),
        JacobiRKAN(3),      # Jacobi polynomial of degree 3
        layers.MaxPooling2D(pool_size=(2, 2)),
        layers.Flatten(),
        layers.Dropout(0.5),
        layers.Dense(16),
        PadeRKAN(2, 6),     # Pade [2/6]
        layers.Dense(num_classes, activation="softmax"),
    ]
)

PyTorch

import torch.nn as nn
from rkan.torch import JacobiRKAN, PadeRKAN

model = nn.Sequential(
    nn.Linear(1, 16),
    JacobiRKAN(3),      # Jacobi polynomial of degree 3
    nn.Linear(16, 32),
    PadeRKAN(2, 6),     # Pade [2/6]
    nn.Linear(32, 1),
)

Experiments

The example folder contains the implementation of the experiments from the paper using rKAN. These experiments include:

Deep Learning Tasks

  • Synthetic Regression
  • MNIST Classification

Physics Informed Deep Learning

  • Lane Emden Ordinary Differential Equation
  • Elliptic Partial Differential Equation

Current Limitations

  • Maximum allowed Jacobi polynomial degree is set to six.
  • The current library is not compatible with other deep learning frameworks, but it can be converted easily.

Contribution

We encourage the community to contribute by opening issues and submitting pull requests to help address these limitations and improve the overall functionality of rKAN.

Contact

If you have any questions or encounter any issues, please open an issue in this repository (preferred) or reach out to the author directly.

Citation

If you use rKAN in your research, please cite our paper:

@article{aghaei2024rkan,
  title={rKAN: Rational Kolmogorov-Arnold Networks},
  author={Aghaei, Alireza Afzal},
  journal={arXiv preprint arXiv:2406.14495},
  year={2024}
}

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

rkan-0.0.2.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

rkan-0.0.2-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file rkan-0.0.2.tar.gz.

File metadata

  • Download URL: rkan-0.0.2.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for rkan-0.0.2.tar.gz
Algorithm Hash digest
SHA256 2260c4e4e7f6fa2b54124e8ef482158d5ae309122629a3c1a63fb399da9d2887
MD5 a4a58c4ecf1f42b4252595190d5ea962
BLAKE2b-256 85dae413b46997d752376988a2f77c7ecb1bbe13086e5006dfc116321a4078aa

See more details on using hashes here.

File details

Details for the file rkan-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: rkan-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for rkan-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4d9357f72ec59d6e0a40baac805d78eea6b0f3b3ed0c90d455a74ec882fb6ef2
MD5 731b5cae62da63c806def32ec8d41738
BLAKE2b-256 1772ff094c9aa590c7ad8d6d915908885ee2c33b453188be1aa5e753a8b661f3

See more details on using hashes here.

Supported by

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