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.3.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

rkan-0.0.3-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rkan-0.0.3.tar.gz
  • Upload date:
  • Size: 7.6 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.3.tar.gz
Algorithm Hash digest
SHA256 af90c9d8cb4eeff100db60b43a5b3535256c2f60923c4e9905d6387e0b14f1ed
MD5 3d615106bf992e5ef8dae5650acd533f
BLAKE2b-256 4c5a1811d3c824808aeaf07a0c0110917273168115980199029b1d83aadd78b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rkan-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.3 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c8eaf168bc7f3194199b76f316c4fc492bbfd8042999aa9d73a44145293a2d16
MD5 60807b513c718f621842823766c9446c
BLAKE2b-256 4c83988e22434781362476501d4f0188f81aa0834036206224aadac18dd05ff3

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