Skip to main content

Temporal KAN model

Project description

TKAN: Temporal Kolmogorov-Arnold Networks

TKAN (Temporal Kolmogorov-Arnold Networks) is a neural network architecture designed to enhance multi-horizon time series forecasting. This Keras implementation integrates TKAN as a layer within sequential models, facilitating the use of advanced neural network techniques in practical applications. The implementation is tested to be compatatible with Tensorflow, Jax and Torch. From testing jax is the best backend in terms of performance with it, while torch is very slow (probably not well optimized for it). It is the original implementation of the paper The KAN part implementation has been inspired from efficient_kan, and is available here and works similarly to it, thus not exactly like the original implementation.

TKAN representation

Installation

Install TKAN directly from PyPI:

pip install tkan

Dependencies are managed using pyproject.toml.

Usage

TKAN can be used within TensorFlow models to handle complex sequential patterns in data. It's implementation reproduce architecture of RNN in tensorflow with Cell class and Layer that inherits from RNN in order to provide a perfect integrations with tensorflow. Here is an example that demonstrates how to use TKAN in a sequential model:

import keras
from tkan import TKAN


# Example model using TKAN with B-spline activations
model = keras.Sequential([
      keras.layers.InputLayer(input_shape=X_train_seq.shape[1:]),
      TKAN(100, sub_kan_configs=[{'spline_order': 3, 'grid_size': 10}, {'spline_order': 1, 'grid_size': 5}, {'spline_order': 4, 'grid_size': 6}, ], return_sequences=True, use_bias=True), #Define the params of the KANLinear as dict as here
      TKAN(100, sub_kan_configs=[1, 2, 3, 3, 4], return_sequences=True, use_bias=True), #Use float or int to specify only the exponent of the spline
      TKAN(100, sub_kan_configs=['relu', 'relu', 'relu', 'relu', 'relu'], return_sequences=True, use_bias=True), #Or use string to specify the standard tensorflow activation using Dense in sublayers instead of KANLinear
      TKAN(100, sub_kan_configs=[None for _ in range(3)], return_sequences=False, use_bias=True), # Or put None for default activation
      keras.layers.Dense(y_train_seq.shape[1]),
])

You can find a more complete example with comparison with other models in the example folder.

Please cite our work if you use this repo:

@article{genet2024tkan,
  title={Tkan: Temporal kolmogorov-arnold networks},
  author={Genet, Remi and Inzirillo, Hugo},
  journal={arXiv preprint arXiv:2405.07344},
  year={2024}
}

Shield: CC BY-NC-SA 4.0

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

CC BY-NC-SA 4.0

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

tkan-0.4.1.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

tkan-0.4.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file tkan-0.4.1.tar.gz.

File metadata

  • Download URL: tkan-0.4.1.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.2 Linux/6.5.0-14-generic

File hashes

Hashes for tkan-0.4.1.tar.gz
Algorithm Hash digest
SHA256 aefa4ad0bdd0befc92af3dd7eebc8776b40993574e8ed1a65a6c1e17c597e890
MD5 783d1b29508575126a5fff504bd9cb0a
BLAKE2b-256 485206c211ba1ab69ad6d632ac1965d72860e3c9fcdccac8a768c5e97b771ba1

See more details on using hashes here.

File details

Details for the file tkan-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: tkan-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.2 Linux/6.5.0-14-generic

File hashes

Hashes for tkan-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 88799ed2bff9dcc128a67bad55615a282b406e43abab20af38b39b72ecc51346
MD5 52ddc536243fc28572a6f8952792d6f4
BLAKE2b-256 7f99654e1e4866145307d0431ce97cb815561d115b1d9b09e1c16d3c60b804ac

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