SineKanPretrained

A tiny, fixed KAN-based approximator for y = sin(x) on the interval 0, π/2. It consists of a single KAN layer whose basis, mixer weights and bias were exported from the accompanying PyTorch script in piekan/train.py, and are embedded here as constants. At runtime, it builds a Module with those values frozen, serving as a lightweight, dependency-free example of loading pretrained KAN parameters in Kotlin.

What it is:

  • A minimal, ready-to-use example demonstrating how to instantiate a KAN layer with predetermined basis/weights/bias to approximate sin(x) on a narrow domain.

  • Deterministic and non-trainable in this form; it does not modify parameters during execution.

What it is not:

  • Not a general-purpose sine model outside 0, π/2; quality may degrade beyond the trained range.

  • Not a full KAN stack or training pipeline; it omits optimizers, loss, and data handling, focusing solely on inference with fixed parameters.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun create(executionContext: ExecutionContext): Module<FP32, Float>

Build the pretrained KAN module with fixed weights/basis/bias.

Link copied to clipboard
fun toGraphvizDot(rankdir: String = "LR"): String

Produce a minimal Graphviz/DOT visualization of this tiny pretrained KAN. This does not depend on any external Graphviz library — it just returns a DOT string that you can render with the dot tool or any Graphviz viewer.