Skip to main content

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}
}

Metadata

Release files for rkan 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rkan 0.0.3
File Size Uploaded Provenance Actions
rkan-0.0.3.tar.gz 7.6 kB Without provenance Details for rkan-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rkan 0.0.3
File Interpreter ABI Platform Actions
rkan-0.0.3-py3-none-any.whl Python 3 none any Details for rkan-0.0.3-py3-none-any.whl

Total release size: 15.0 kB

Release files / rkan-0.0.3.tar.gz

Download URL rkan-0.0.3.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
af90c9d8cb4eeff100db60b43a5b3535256c2f60923c4e9905d6387e0b14f1ed
BLAKE2b-256 checksum
How to use checksums
4c5a1811d3c824808aeaf07a0c0110917273168115980199029b1d83aadd78b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.5

Release files / rkan-0.0.3-py3-none-any.whl

Download URL rkan-0.0.3-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c8eaf168bc7f3194199b76f316c4fc492bbfd8042999aa9d73a44145293a2d16
BLAKE2b-256 checksum
How to use checksums
4c83988e22434781362476501d4f0188f81aa0834036206224aadac18dd05ff3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.5

Security for rkan 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page