oikan 0.0.1.11__py3-none-any.whl → 0.0.2.2__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/visualize.py DELETED
@@ -1,69 +0,0 @@
1
- import torch
2
- import numpy as np
3
- import matplotlib.pyplot as plt
4
-
5
- def visualize_regression(model, X, y):
6
- '''Visualize regression results using true vs predicted scatter plots.'''
7
- model.eval()
8
- with torch.no_grad():
9
- y_pred = model(torch.FloatTensor(X)).numpy()
10
- plt.figure(figsize=(10, 6))
11
- plt.scatter(X[:, 0], y, color='blue', label='True')
12
- plt.scatter(X[:, 0], y_pred, color='red', label='Predicted')
13
- plt.legend()
14
- plt.show()
15
-
16
- def visualize_classification(model, X, y):
17
- '''Visualize classification decision boundaries. For high-dimensional data, uses SVD projection.'''
18
- model.eval()
19
- if X.shape[1] > 2:
20
- X_mean = np.mean(X, axis=0)
21
- X_centered = X - X_mean
22
- _, _, Vt = np.linalg.svd(X_centered, full_matrices=False)
23
- principal = Vt[:2]
24
- X_proj = (X - X_mean) @ principal.T
25
- x_min, x_max = X_proj[:, 0].min() - 1, X_proj[:, 0].max() + 1
26
- y_min, y_max = X_proj[:, 1].min() - 1, X_proj[:, 1].max() + 1
27
- xx, yy = np.meshgrid(np.linspace(x_min, x_max, 100),
28
- np.linspace(y_min, y_max, 100))
29
- grid_2d = np.c_[xx.ravel(), yy.ravel()]
30
- X_grid = X_mean + grid_2d @ principal
31
- with torch.no_grad():
32
- Z = model(torch.FloatTensor(X_grid))
33
- Z = torch.argmax(Z, dim=1).numpy().reshape(xx.shape)
34
- plt.figure(figsize=(10, 8))
35
- plt.contourf(xx, yy, Z, alpha=0.4)
36
- plt.scatter(X_proj[:, 0], X_proj[:, 1], c=y, alpha=0.8)
37
- plt.title("Classification Visualization (SVD Projection)")
38
- plt.show()
39
- else:
40
- x_min, x_max = X[:, 0].min() - 1, X[:, 0].max() + 1
41
- y_min, y_max = X[:, 1].min() - 1, X[:, 1].max() + 1
42
- xx, yy = np.meshgrid(np.linspace(x_min, x_max, 100),
43
- np.linspace(y_min, y_max, 100))
44
- grid_2d = np.c_[xx.ravel(), yy.ravel()]
45
- with torch.no_grad():
46
- Z = model(torch.FloatTensor(grid_2d))
47
- Z = torch.argmax(Z, dim=1).numpy().reshape(xx.shape)
48
- plt.figure(figsize=(10, 8))
49
- plt.contourf(xx, yy, Z, alpha=0.4)
50
- plt.scatter(X[:, 0], X[:, 1], c=y, alpha=0.8)
51
-
52
- def visualize_time_series_forecasting(model, X, y):
53
- '''
54
- Visualize time series forecasting results by plotting true vs predicted values.
55
- Expected X shape: [samples, seq_len, features] and y: true targets.
56
- '''
57
- model.eval()
58
- with torch.no_grad():
59
- y_pred = model(X).detach().cpu().numpy()
60
- if isinstance(y, torch.Tensor):
61
- y = y.detach().cpu().numpy()
62
- plt.figure(figsize=(10, 5))
63
- plt.plot(y, label='True', marker='o', linestyle='-')
64
- plt.plot(y_pred, label='Predicted', marker='x', linestyle='--')
65
- plt.xlabel("Time Step")
66
- plt.ylabel("Value")
67
- plt.title("Time Series Forecasting Visualization")
68
- plt.legend()
69
- plt.show()
@@ -1,105 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: oikan
3
- Version: 0.0.1.11
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
- License-File: LICENSE
13
- Requires-Dist: torch
14
- Requires-Dist: numpy
15
- Requires-Dist: sympy
16
- Requires-Dist: scipy
17
- Requires-Dist: matplotlib
18
-
19
- # OIKAN
20
-
21
- Optimized Interpretable Kolmogorov-Arnold Networks (OIKAN)
22
- A deep learning framework for interpretable neural networks using advanced basis functions.
23
-
24
- [![PyPI version](https://badge.fury.io/py/oikan.svg)](https://badge.fury.io/py/oikan)
25
- [![PyPI Downloads per month](https://img.shields.io/pypi/dm/oikan.svg)](https://pypistats.org/packages/oikan)
26
- [![PyPI Total Downloads](https://static.pepy.tech/badge/oikan)](https://pepy.tech/projects/oikan)
27
- [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
28
- [![GitHub issues](https://img.shields.io/github/issues/silvermete0r/OIKAN.svg)](https://github.com/silvermete0r/oikan/issues)
29
- [![Docs](https://img.shields.io/badge/docs-passing-brightgreen)](https://silvermete0r.github.io/oikan/)
30
-
31
- ## Key Features
32
- - 🚀 Efficient Implementation ~ Optimized KAN architecture with SVD projection
33
- - 📊 Advanced Basis Functions ~ B-spline and Fourier basis transformations
34
- - 🎯 Multi-Task Support ~ Both regression and classification capabilities
35
- - 🔍 Interpretability Tools ~ Extract and visualize symbolic formulas
36
- - 📈 Interactive Visualizations ~ Built-in plotting and analysis tools
37
- - 🧮 Symbolic Mathematics ~ LaTeX formula extraction and symbolic approximations
38
-
39
- ## Installation
40
-
41
- ### Method 1: Via PyPI (Recommended)
42
- ```bash
43
- pip install oikan
44
- ```
45
-
46
- ### Method 2: Local Development
47
- ```bash
48
- git clone https://github.com/silvermete0r/OIKAN.git
49
- cd OIKAN
50
- pip install -e . # Install in development mode
51
- ```
52
-
53
- ## Quick Start
54
-
55
- ### Regression Example
56
- ```python
57
- from oikan.model import OIKAN
58
- from oikan.trainer import train
59
- from oikan.visualize import visualize_regression
60
- from oikan.symbolic import extract_symbolic_formula, plot_symbolic_formula, extract_latex_formula
61
-
62
- model = OIKAN(input_dim=2, output_dim=1)
63
- train(model, (X_train, y_train))
64
-
65
- visualize_regression(model, X, y)
66
-
67
- formula = extract_symbolic_formula(model, X_test, mode='regression')
68
- print("Extracted formula:", formula)
69
-
70
- plot_symbolic_formula(model, X_test, mode='regression')
71
-
72
- latex_formula = extract_latex_formula(model, X_test, mode='regression')
73
- print("LaTeX:", latex_formula)
74
- ```
75
-
76
- ### Classification Example
77
- ```python
78
- from oikan.model import OIKAN
79
- from oikan.trainer import train_classification
80
- from oikan.visualize import visualize_classification
81
- from oikan.symbolic import extract_symbolic_formula, plot_symbolic_formula, extract_latex_formula
82
-
83
- model = OIKAN(input_dim=2, output_dim=2)
84
- train_classification(model, (X_train, y_train))
85
-
86
- visualize_classification(model, X_test, y_test)
87
-
88
- formula = extract_symbolic_formula(model, X_test, mode='classification')
89
- print("Extracted formula:", formula)
90
-
91
- plot_symbolic_formula(model, X_test, mode='classification')
92
-
93
- latex_formula = extract_latex_formula(model, X_test, mode='classification')
94
- print("LaTeX:", latex_formula)
95
- ```
96
-
97
- ## Usage
98
- - Explore the `oikan/` folder for model architectures, training routines, and symbolic extraction.
99
- - Check the `examples/` directory for complete usage examples for both regression and classification.
100
-
101
- ## Contributing
102
- Contributions are welcome! Submit a Pull Request with your improvements.
103
-
104
- ## License
105
- This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
@@ -1,13 +0,0 @@
1
- oikan/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- oikan/metrics.py,sha256=IF13bW3evsyKfZC2jhI-MPRu2Rl77Elo3of68OF_JW8,1928
3
- oikan/model.py,sha256=blpTiAFQ-LxhvWedP5Yf5TgdwlOb4t1BuBMe9d-kJZ0,5342
4
- oikan/regularization.py,sha256=xt8JNnPdHRAQgzF_vnyme005hWLunz9Vo2qw6m08NMM,1145
5
- oikan/symbolic.py,sha256=RRYHOCOCJr5KXRhdcCPvT_OqyNcCnWCWt7fOtos8rRI,5765
6
- oikan/trainer.py,sha256=PwA8PnVUiv5wYlQqj3DTplCAUZljZ4iWJUKUDvmIvX0,2062
7
- oikan/utils.py,sha256=xbVgrbhXYj57RdD3uNPchjyfmP6Kur7tngoZPa3qWOw,2094
8
- oikan/visualize.py,sha256=ZZiRf0P8cuBiC0reBBGVnSTotBq5oxQIRIEgqSrN6u8,2916
9
- oikan-0.0.1.11.dist-info/LICENSE,sha256=75ASVmU-XIpN-M4LbVmJ_ibgbzbvRLVti8FhnR0BTf8,1096
10
- oikan-0.0.1.11.dist-info/METADATA,sha256=5EpY9clgm3iQ2nLrtLesX-H8sUhZU_lL7bTEPDFj54U,3848
11
- oikan-0.0.1.11.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
12
- oikan-0.0.1.11.dist-info/top_level.txt,sha256=XwnwKwTJddZwIvtrUsAz-l-58BJRj6HjAGWrfYi_3QY,6
13
- oikan-0.0.1.11.dist-info/RECORD,,