oikan 0.0.1.3__py3-none-any.whl → 0.0.1.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
oikan/symbolic.py CHANGED
@@ -122,6 +122,9 @@ def extract_latex_formula(model, X, mode='regression'):
122
122
  expr = term.strip("()")
123
123
  coeff_str, basis = expr.split("*", 1) if "*" in expr else (expr, "")
124
124
  coeff = float(coeff_str)
125
+ missing = basis.count("(") - basis.count(")")
126
+ if missing > 0:
127
+ basis = basis + ")" * missing
125
128
  coeff_latex = f"{abs(coeff):.2f}".rstrip("0").rstrip(".")
126
129
  term_latex = coeff_latex if basis.strip() == "1" else f"{coeff_latex} \\cdot {basis.strip()}"
127
130
  latex_terms.append(f"- {term_latex}" if coeff < 0 else f"+ {term_latex}")
@@ -0,0 +1,81 @@
1
+ Metadata-Version: 2.2
2
+ Name: oikan
3
+ Version: 0.0.1.4
4
+ Summary: OIKAN: Optimized Interpretable Kolmogorov-Arnold Networks
5
+ Author: Arman Zhalgasbayev
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.7
11
+ Description-Content-Type: text/markdown
12
+ Requires-Dist: torch
13
+ Requires-Dist: numpy
14
+ Requires-Dist: sympy
15
+ Requires-Dist: scipy
16
+ Requires-Dist: matplotlib
17
+
18
+ # OIKAN
19
+
20
+ Optimized Interpretable Kolmogorov-Arnold Networks (OIKAN)
21
+ A deep learning framework for interpretable neural networks using advanced basis functions.
22
+
23
+ [![PyPI version](https://badge.fury.io/py/oikan.svg)](https://badge.fury.io/py/oikan)
24
+ [![PyPI downloads](https://img.shields.io/pypi/dm/oikan.svg)](https://pypistats.org/packages/oikan)
25
+
26
+ ## Key Features
27
+ - EfficientKAN layer implementation
28
+ - Built-in visualization tools
29
+ - Support for both regression and classification tasks
30
+ - Symbolic formula extraction
31
+ - Easy-to-use training interface
32
+ - LaTeX-formatted formula extraction
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ git clone https://github.com/silvermete0r/OIKAN.git
38
+ cd OIKAN
39
+ pip install -e . # Install in development mode
40
+ ```
41
+
42
+ ## Quick Start
43
+
44
+ ### Regression Example
45
+ ```python
46
+ from oikan.model import OIKAN
47
+ from oikan.trainer import train
48
+ from oikan.symbolic import extract_symbolic_formula
49
+
50
+ model = OIKAN(input_dim=2, output_dim=1)
51
+ train(model, (X_train, y_train))
52
+ formula = extract_symbolic_formula(model, X_test, mode='regression')
53
+ print("Extracted formula:", formula)
54
+ ```
55
+
56
+ ### Classification Example
57
+ ```python
58
+ from oikan.model import OIKAN
59
+ from oikan.trainer import train_classification
60
+ from oikan.visualize import visualize_classification
61
+ from oikan.symbolic import extract_symbolic_formula, plot_symbolic_formula, extract_latex_formula
62
+
63
+ model = OIKAN(input_dim=2, output_dim=2)
64
+ train_classification(model, (X_train, y_train))
65
+ visualize_classification(model, X_test, y_test)
66
+ formula = extract_symbolic_formula(model, X_test, mode='classification')
67
+ print("Extracted formula:", formula)
68
+ plot_symbolic_formula(model, X_test, mode='classification')
69
+ latex_formula = extract_latex_formula(model, X_test, mode='classification')
70
+ print("LaTeX:", latex_formula)
71
+ ```
72
+
73
+ ## Usage
74
+ - Explore the `oikan/` folder for model architectures, training routines, and symbolic extraction.
75
+ - Check the `examples/` directory for complete usage examples for both regression and classification.
76
+
77
+ ## Contributing
78
+ Contributions are welcome! Submit a Pull Request with your improvements.
79
+
80
+ ## License
81
+ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
@@ -1,11 +1,11 @@
1
1
  oikan/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  oikan/model.py,sha256=9_U3jh1YwASbLOgHpFm4F80J3QGEhzIgQHNkqbZCPJs,2920
3
3
  oikan/regularization.py,sha256=D0Xc2lr5X5ORdA5ltvWDbNDuN8z0hkyoGzFo7pum2XE,1033
4
- oikan/symbolic.py,sha256=SGYWwNIQYjc_ik2bIF-_0LckWImHGECzn773btbqees,5394
4
+ oikan/symbolic.py,sha256=K1aI5JEPgKFu8dyjXxWDA-UZm8Gvfp0lU1M7c2NAPLY,5517
5
5
  oikan/trainer.py,sha256=itFCHSR_T6KHqa0D5RLRCmqFHa4lUIamsFGWKHmUZuI,1258
6
6
  oikan/utils.py,sha256=XwY6pgAgfYlUI9SOjdop91wh0_t6LfPLCiHretlw2Wg,1754
7
7
  oikan/visualize.py,sha256=8Dlk-tsqGZb63NyZBpZsLSlcsC51m2nXblQaS2Jf1y0,1142
8
- oikan-0.0.1.3.dist-info/METADATA,sha256=3vY37GVJC0yuOQJCM0gggAu7FXyRu8WMje3Gfs9_XpA,1872
9
- oikan-0.0.1.3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
10
- oikan-0.0.1.3.dist-info/top_level.txt,sha256=XwnwKwTJddZwIvtrUsAz-l-58BJRj6HjAGWrfYi_3QY,6
11
- oikan-0.0.1.3.dist-info/RECORD,,
8
+ oikan-0.0.1.4.dist-info/METADATA,sha256=G-HWX8CkuSzPWDLDIdn_NYVehCfVrEfuLbnaSuQbsxw,2726
9
+ oikan-0.0.1.4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
10
+ oikan-0.0.1.4.dist-info/top_level.txt,sha256=XwnwKwTJddZwIvtrUsAz-l-58BJRj6HjAGWrfYi_3QY,6
11
+ oikan-0.0.1.4.dist-info/RECORD,,
@@ -1,65 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: oikan
3
- Version: 0.0.1.3
4
- Summary: OIKAN: Optimized Interpretable Kolmogorov-Arnold Networks
5
- Author: Arman Zhalgasbayev
6
- License: MIT
7
- Classifier: Programming Language :: Python :: 3
8
- Classifier: License :: OSI Approved :: MIT License
9
- Classifier: Operating System :: OS Independent
10
- Requires-Python: >=3.7
11
- Description-Content-Type: text/markdown
12
- Requires-Dist: torch
13
- Requires-Dist: numpy
14
- Requires-Dist: sympy
15
- Requires-Dist: scipy
16
- Requires-Dist: matplotlib
17
-
18
- # OIKAN Library
19
-
20
- [![PyPI version](https://badge.fury.io/py/oikan.svg)](https://badge.fury.io/py/oikan)
21
- [![PyPI downloads](https://img.shields.io/pypi/dm/oikan.svg)](https://pypistats.org/packages/oikan)
22
-
23
- OIKAN (Optimized Implementation of Kolmogorov-Arnold Networks) is a PyTorch-based library for creating interpretable neural networks. It implements the KAN architecture to provide both accurate predictions and interpretable results.
24
-
25
- ## Key Features
26
-
27
- - EfficientKAN layer implementation
28
- - Built-in visualization tools
29
- - Support for both regression and classification tasks
30
- - Symbolic formula extraction
31
- - Easy-to-use training interface
32
-
33
- ## Installation
34
-
35
- ```bash
36
- git clone https://github.com/silvermete0r/OIKAN.git
37
- cd OIKAN
38
- pip install -e . # Install in development mode
39
- ```
40
-
41
- ## Quick Start
42
-
43
- ### Regression Example
44
- ```python
45
- from oikan.model import OIKAN
46
- from oikan.trainer import train
47
-
48
- # Create and train model
49
- model = OIKAN(input_dim=2, output_dim=1)
50
- train(model, train_loader)
51
-
52
- # Extract interpretable formula
53
- formula = extract_symbolic_formula_regression(model, X)
54
- ```
55
-
56
- ### Classification Example
57
- ```python
58
- model = OIKAN(input_dim=2, output_dim=2)
59
- train_classification(model, train_loader)
60
- visualize_classification(model, X, y)
61
- ```
62
-
63
- ## Contributing
64
-
65
- Contributions are welcome! Please feel free to submit a Pull Request.