Kan.py [480p]
(often referred to as pykan ) is the official Python implementation of Kolmogorov-Arnold Networks (KANs) , a novel neural network architecture inspired by the Kolmogorov-Arnold representation theorem. Unlike traditional Multi-Layer Perceptrons (MLPs) that use fixed activation functions on "neurons" (nodes), KANs place learnable activation functions—typically splines—directly on the "weights" (edges) of the network. Core Concept: The KAN Architecture
: Nodes in a KAN simply sum the incoming signals; they do not have their own activation functions like ReLU or Sigmoid.
: In a standard MLP, a connection is just a single number ( kan.py
: Because the functions are univariate splines, they are easier for humans to visualize and understand, making KANs particularly useful for AI for Science . The pykan Library
While more parameter-efficient for some tasks, the current implementation is often slower than optimized MLPs. (often referred to as pykan ) is the
The fundamental shift in KANs is the replacement of fixed linear weights with univariate functions.
Supports CPU and GPU, though GPU support may require specific configurations in early versions. : In a standard MLP, a connection is
from kan import KAN import torch # Create a KAN with 2 inputs, 5 hidden neurons, and 1 output model = KAN(width=[2, 5, 1], grid=5, k=3) # Training follows a standard loop structure # model.train(dataset, opt="LBFGS", steps=20) Use code with caution. Copied to clipboard