Skip to main content

OIKAN: Optimized Interpretable Kolmogorov-Arnold Networks

Project description

OIKAN Logo

OIKAN: Optimized Interpretable Kolmogorov-Arnold Networks

Overview

OIKAN (Optimized Interpretable Kolmogorov-Arnold Networks) is a neuro-symbolic ML framework that combines modern neural networks with classical Kolmogorov-Arnold representation theory. It provides interpretable machine learning solutions through automatic extraction of symbolic mathematical formulas from trained models.

PyPI version PyPI Downloads per month PyPI Total Downloads License GitHub issues Docs

Key Features

  • 🧠 Neuro-Symbolic ML: Combines neural network learning with symbolic mathematics
  • 📊 Automatic Formula Extraction: Generates human-readable mathematical expressions
  • 🎯 Scikit-learn Compatible: Familiar .fit() and .predict() interface
  • 🚀 Production-Ready: Export symbolic formulas for lightweight deployment
  • 📈 Multi-Task: Supports both regression and classification problems

Scientific Foundation

OIKAN is based on Kolmogorov's superposition theorem, which states that any multivariate continuous function can be represented as a composition of single-variable functions. We leverage this theory by:

  1. Using neural networks to learn optimal basis functions through interpretable edge transformations
  2. Combining transformed features using learnable weights
  3. Automatically extracting human-readable symbolic formulas

Quick Start

Installation

Method 1: Via PyPI (Recommended)

pip install -qU oikan

Method 2: Local Development

git clone https://github.com/silvermete0r/OIKAN.git
cd OIKAN
pip install -e .  # Install in development mode

Regression Example

from oikan.model import OIKANRegressor
from sklearn.model_selection import train_test_split

# Initialize model with optimal architecture
model = OIKANRegressor(
    hidden_dims=[16, 8],  # Network architecture
    num_basis=10,         # Number of basis functions
    degree=3,             # Polynomial degree
    dropout=0.1           # Regularization
)

# Fit model (sklearn-style)
model.fit(X_train, y_train, epochs=200, lr=0.01)

# Get predictions
y_pred = model.predict(X_test)

# Save interpretable formula to file with auto-generated guidelines
# The output file will contain:
# - Detailed symbolic formulas for each feature
# - Instructions for practical implementation
# - Recommendations for production deployment
model.save_symbolic_formula("regression_formula.txt")

Example of the saved symbolic formula instructions: outputs/regression_symbolic_formula.txt

Classification Example

from oikan.model import OIKANClassifier

# Similar sklearn-style interface for classification
model = OIKANClassifier(hidden_dims=[16, 8])
model.fit(X_train, y_train)
probas = model.predict_proba(X_test)

# Save classification formulas with implementation guidelines
# The output file will contain:
# - Decision boundary formulas for each class
# - Softmax application instructions
# - Production deployment recommendations
model.save_symbolic_formula("classification_formula.txt")

Example of the saved symbolic formula instructions: outputs/classification_symbolic_formula.txt

Architecture Details

OIKAN implements a novel neuro-symbolic architecture based on Kolmogorov-Arnold representation theory through three specialized components:

  1. Edge Symbolic Layer: Learns interpretable single-variable transformations

    • Adaptive basis function composition using 9 core functions:
      ADVANCED_LIB = {
          'x':    ('x', lambda x: x),
          'x^2':  ('x^2', lambda x: x**2),
          'x^3':  ('x^3', lambda x: x**3),
          'exp':  ('exp(x)', lambda x: np.exp(x)),
          'log':  ('log(x)', lambda x: np.log(abs(x) + 1)),
          'sqrt': ('sqrt(x)', lambda x: np.sqrt(abs(x))),
          'tanh': ('tanh(x)', lambda x: np.tanh(x)),
          'sin':  ('sin(x)', lambda x: np.sin(x)),
          'abs':  ('abs(x)', lambda x: np.abs(x))
      }
      
    • Each input feature is transformed through these basis functions
    • Learnable weights determine the optimal combination
  2. Neural Composition Layer: Multi-layer feature aggregation

    • Direct feature-to-feature connections through KAN layers
    • Dropout regularization (p=0.1 default) for robust learning
    • Gradient clipping (max_norm=1.0) for stable training
    • User-configurable hidden layer dimensions
  3. Symbolic Extraction Layer: Generates production-ready formulas

    • Weight-based term pruning (threshold=1e-4)
    • Automatic coefficient optimization
    • Human-readable mathematical expressions
    • Exportable to lightweight production code

Architecture Diagram

Architecture Diagram

Key Design Principles

  1. Interpretability First: All transformations maintain clear mathematical meaning
  2. Scikit-learn Compatibility: Familiar .fit() and .predict() interface
  3. Production Ready: Export formulas as lightweight mathematical expressions
  4. Automatic Simplification: Remove insignificant terms (|w| < 1e-4)

Model Components

  1. Symbolic Edge Functions

    class EdgeActivation(nn.Module):
        """Learnable edge activation with basis functions"""
        def forward(self, x):
            return sum(self.weights[i] * basis[i](x) for i in range(self.num_basis))
    
  2. KAN Layer Implementation

    class KANLayer(nn.Module):
        """Kolmogorov-Arnold Network layer"""
        def forward(self, x):
            edge_outputs = [self.edges[i](x[:,i]) for i in range(self.input_dim)]
            return self.combine(edge_outputs)
    
  3. Formula Extraction

    def get_symbolic_formula(self):
        """Extract interpretable mathematical expression"""
        terms = []
        for i, edge in enumerate(self.edges):
            if abs(self.weights[i]) > threshold:
                terms.append(f"{self.weights[i]:.4f} * {edge.formula}")
        return " + ".join(terms)
    

Key Design Principles

  • Modular Architecture: Each component is independent and replaceable
  • Interpretability First: All transformations maintain symbolic representations
  • Automatic Simplification: Removes insignificant terms and combines similar expressions
  • Production Ready: Export formulas for lightweight deployment

Contributing

We welcome contributions! Key areas of interest:

  • Model architecture improvements
  • Novel basis function implementations
  • Improved symbolic extraction algorithms
  • Real-world case studies and applications
  • Performance optimizations

Please see CONTRIBUTING.md for guidelines.

Citation

If you use OIKAN in your research, please cite:

@software{oikan2025,
  title = {OIKAN: Optimized Interpretable Kolmogorov-Arnold Networks},
  author = {Zhalgasbayev, Arman},
  year = {2025},
  url = {https://github.com/silvermete0r/OIKAN}
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

oikan-0.0.2.2.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oikan-0.0.2.2-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file oikan-0.0.2.2.tar.gz.

File metadata

  • Download URL: oikan-0.0.2.2.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.13

File hashes

Hashes for oikan-0.0.2.2.tar.gz
Algorithm Hash digest
SHA256 c948a6f3fd501d9ed64181e858d33fd317c12962a3884c983f40b89b136aa837
MD5 755bfec36105687d2c9e2a9699092e0f
BLAKE2b-256 d741481e006f5a6ee8e11390fec791cec7cd21a9ca01bacb4857aed9dba9f65e

See more details on using hashes here.

File details

Details for the file oikan-0.0.2.2-py3-none-any.whl.

File metadata

  • Download URL: oikan-0.0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.13

File hashes

Hashes for oikan-0.0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3e8deea37c5047d0459e2d9badc6055271a2257069029c5e038b0b72f8107ef2
MD5 8045b4208d3b394b07725bad6036216b
BLAKE2b-256 8c67bbd88ae3b88c95ef2ab1e0be00ae2cbc279312344a6cc01454bb906c4bce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page