How silvermete0r/oikan works
Purpose and Public Entry Points
OIKAN is a Python neuro-symbolic ML library for tabular regression and classification. Its public estimators expose scikit-learn-style fit, predict, score, formula retrieval, feature importance, and JSON persistence APIs. Package exports begin at oikan/__init__.py; estimator orchestration is centered in oikan/model.py.
Estimator Orchestration
OIKANRegressor and OIKANClassifier coordinate the end-to-end workflow: validate inputs, train/evaluate an auxiliary neural model, augment data, fit symbolic models, and expose inference/export interfaces. Classification must manage a separate symbolic model per class; regression yields one coefficient vector.
• oikan/model.py
• oikan/__init__.py
• oikan/exceptions.py
Neural Learning and Augmentation Boundary
A PyTorch tabular neural network provides learned predictions used to augment original training data with noisy/generated samples. This neural stage supports configurable hidden layers, activations, batching, epochs, learning rate, optional GPU use, and pre-symbolic evaluation. The neural model is auxiliary; exported inference is intended to rely on symbolic formulas rather than PyTorch weights.
• oikan/neural.py
• oikan/model.py
Symbolic Feature Construction and Sparse Regression
The symbolic layer expands input features into interpretable basis terms—polynomials, interactions, trigonometric, exponential, and logarithmic transforms—then applies ElasticNet regularization to select/prune terms. Coefficients and retained basis metadata form the deployable model representation.
• oikan/elasticnet.py
• oikan/utils.py
• oikan/model.py
Formula and Model Serialization
Selected basis functions plus coefficients are rendered as original symbolic strings or transformed through SymPy into simplified and LaTeX formats. Model save/load uses JSON artifacts containing feature counts, basis-function metadata, and regression coefficients or classification coefficient lists.
• oikan/model.py
• outputs/california_housing_model.json
• outputs/iris_model.json
Cross-Language Deployment Compilers
Language-specific compiler implementations consume exported symbolic-model JSON and reproduce basis evaluation plus linear prediction. Regression compilers return a scalar/vector prediction; classifier compilers compute class logits, softmax probabilities, and argmax labels. Each target language maintains distinct regression and classification implementations.
• model_compilers/python/regression_compiler.py
• model_compilers/cpp/classification_compiler.cpp
• model_compilers/rust/regression_compiler.rs
Runtime, Dependencies, and Delivery
The primary runtime is Python 3.11+ with PyTorch for neural training, NumPy for arrays, scikit-learn for ElasticNet/estimator conventions, and SymPy for formula formatting. The project is distributed as a PyPI package through pyproject.toml/setup.py; static documentation is published from docs/, with GitHub Actions static-site automation.
• pyproject.toml
• requirements.txt
• setup.py
Main entry points: model.py Regressor & classifier · california_housing_model.json Model JSON artifacts · __init__.py Public package API · neural.py Auxiliary neural model
Components 12
Python library
- Public package API · Exports the estimator API.
oikan/__init__.py - Regressor & classifier · Coordinates training, inference, formulas, and persistence.
oikan/model.py - Library exceptions
oikan/exceptions.py - Auxiliary neural model · Produces predictions for augmentation and pre-symbolic evaluation.
oikan/neural.py
Symbolic modeling
- Basis expansion · Builds interpretable polynomial and transformed terms.
oikan/utils.py - Sparse symbolic fitting · Selects basis terms and learns deployable coefficients.
oikan/elasticnet.py - Formula rendering · Renders selected terms as simplified and LaTeX formulas.
oikan/model.py
Deployment targets
- Model JSON artifacts · Stores feature metadata and regression or per-class coefficients.
outputs/california_housing_model.json - Python regression compiler · Reproduces basis evaluation and linear regression prediction.
model_compilers/python/regression_compiler.py - C++ classifier compiler · Computes class logits, softmax probabilities, and labels.
model_compilers/cpp/classification_compiler.cpp - Rust regression compiler · Reproduces basis evaluation and linear regression prediction.
model_compilers/rust/regression_compiler.rs
Other components
- PyPI distribution · Defines the Python 3.11+ package and dependencies.
pyproject.toml
Connections 13
- Public package API → Regressor & classifier: exports
- Regressor & classifier → Library exceptions: raises
- Regressor & classifier → Auxiliary neural model: trains and evaluates
- Auxiliary neural model → Regressor & classifier: predictions augment data
- Regressor & classifier → Basis expansion: builds terms
- Basis expansion → Sparse symbolic fitting: expanded features
- Sparse symbolic fitting → Regressor & classifier: coefficients and retained terms
- Regressor & classifier → Formula rendering: renders formulas
- Regressor & classifier → Model JSON artifacts: saves and loads JSON
- Model JSON artifacts → Python regression compiler: consumed by
- Model JSON artifacts → C++ classifier compiler: consumed by
- Model JSON artifacts → Rust regression compiler: consumed by
- PyPI distribution → Public package API: packages