-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ziming Liu
committed
Apr 27, 2024
1 parent
e15cc47
commit 5ac3a58
Showing
43 changed files
with
375 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
API Demos | ||
--------- | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
API_demo/API_1_indexing.rst | ||
API_demo/API_2_plotting.rst | ||
API_demo/API_3_grid.rst | ||
API_demo/API_4_extract_activations.rst | ||
API_demo/API_5_initialization_hyperparameter.rst | ||
API_demo/API_6_training_hyperparameter.rst | ||
API_demo/API_7_pruning.rst | ||
API_demo/API_8_checkpoint.rst | ||
API_demo/API_9_video.rst | ||
API_demo/API_10_device.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
.. kolmogorov-arnold-network documentation master file, created by | ||
sphinx-quickstart on Sun Apr 21 12:57:28 2024. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
Welcome to Kolmogorov Aarnold Network (KAN) documentation! | ||
========================================================== | ||
|
||
This documentation is for the paper "KAN: Kolmogorov-Arnold Networks" and the github repo can be found here. | ||
|
||
.. image:: kan_plot.png | ||
|
||
Get the latest news at `CNN`_. (Add links to paper and github repo) | ||
|
||
.. _CNN: http://cnn.com/ | ||
|
||
There are two ways to install kan. The first way is via pip install | ||
|
||
.. code-block:: python | ||
pip install kan | ||
The second way is via github | ||
|
||
.. code-block:: python | ||
git clone repolink | ||
cd kan | ||
pip install -e . | ||
.. toctree:: | ||
:maxdepth: 1 | ||
:caption: Contents: | ||
|
||
intro.rst | ||
modules.rst | ||
demos.rst | ||
examples.rst | ||
|
||
Indices and tables | ||
================== | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` |
Large diffs are not rendered by default.
Oops, something went wrong.
110 changes: 110 additions & 0 deletions
110
docs/API_demo/.ipynb_checkpoints/API_10_device-checkpoint.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
Demo 10: Device | ||
=============== | ||
|
||
All other demos have by default used device = ‘cpu’. In case we want to | ||
use cuda, we should pass the device argument to model and dataset. | ||
|
||
.. code:: ipython3 | ||
from kan import KAN, create_dataset | ||
import torch | ||
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') | ||
print(device) | ||
.. parsed-literal:: | ||
cuda | ||
.. code:: ipython3 | ||
model = KAN(width=[4,2,1,1], grid=3, k=3, seed=0, device=device) | ||
f = lambda x: torch.exp((torch.sin(torch.pi*(x[:,[0]]**2+x[:,[1]]**2))+torch.sin(torch.pi*(x[:,[2]]**2+x[:,[3]]**2)))/2) | ||
dataset = create_dataset(f, n_var=4, train_num=3000, device=device) | ||
# train the model | ||
#model.train(dataset, opt="LBFGS", steps=20, lamb=1e-3, lamb_entropy=2.); | ||
model.train(dataset, opt="LBFGS", steps=50, lamb=5e-5, lamb_entropy=2.); | ||
.. parsed-literal:: | ||
train loss: 6.70e-03 | test loss: 6.83e-03 | reg: 7.91e+00 : 100%|██| 50/50 [00:25<00:00, 1.99it/s] | ||
.. code:: ipython3 | ||
model.plot() | ||
.. image:: API_10_device_files/API_10_device_3_0.png | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Metadata-Version: 2.1 | ||
Name: pykan | ||
Version: 0.0.1 | ||
Summary: Kolmogorov Arnold Networks | ||
Author: Ziming Liu | ||
Author-email: [email protected] | ||
Classifier: Programming Language :: Python :: 3 | ||
Classifier: License :: OSI Approved :: MIT License | ||
Classifier: Operating System :: OS Independent | ||
Requires-Python: >=3.6 | ||
Description-Content-Type: text/markdown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
README.md | ||
setup.py | ||
kan/KAN.py | ||
kan/KANLayer.py | ||
kan/LBFGS.py | ||
kan/Symbolic_KANLayer.py | ||
kan/__init__.py | ||
kan/spline.py | ||
kan/utils.py | ||
pykan.egg-info/PKG-INFO | ||
pykan.egg-info/SOURCES.txt | ||
pykan.egg-info/dependency_links.txt | ||
pykan.egg-info/top_level.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
kan |