oikan 0.0.1.9__py3-none-any.whl → 0.0.1.10__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/trainer.py CHANGED
@@ -2,7 +2,7 @@ import torch
2
2
  import torch.nn as nn
3
3
  from .regularization import RegularizedLoss
4
4
 
5
- def train(model, train_data, epochs=100, lr=0.01, save_path=None):
5
+ def train(model, train_data, epochs=100, lr=0.01, save_path=None, verbose=True):
6
6
  '''Train regression model using MSE loss with regularization.
7
7
  Optionally save the model when training is finished if save_path is provided.
8
8
  '''
@@ -19,13 +19,13 @@ def train(model, train_data, epochs=100, lr=0.01, save_path=None):
19
19
  loss.backward() # Backpropagate errors
20
20
  optimizer.step() # Update parameters
21
21
 
22
- if (epoch + 1) % 10 == 0:
22
+ if (epoch + 1) % 10 == 0 and verbose:
23
23
  print(f'Epoch [{epoch+1}/{epochs}], Loss: {loss.item():.4f}')
24
- if save_path:
24
+ if save_path is not None:
25
25
  torch.save(model.state_dict(), save_path)
26
26
  print(f"Model saved to {save_path}")
27
27
 
28
- def train_classification(model, train_data, epochs=100, lr=0.01, save_path=None):
28
+ def train_classification(model, train_data, epochs=100, lr=0.01, save_path=None, verbose=True):
29
29
  '''Train classification model using CrossEntropy loss with regularization.
30
30
  Optionally save the model when training is finished if save_path is provided.
31
31
  '''
@@ -42,8 +42,8 @@ def train_classification(model, train_data, epochs=100, lr=0.01, save_path=None)
42
42
  loss.backward() # Backpropagation
43
43
  optimizer.step() # Parameter update
44
44
 
45
- if (epoch + 1) % 10 == 0:
45
+ if (epoch + 1) % 10 == 0 and verbose:
46
46
  print(f'Epoch [{epoch+1}/{epochs}], Loss: {loss.item():.4f}')
47
- if save_path:
47
+ if save_path is not None:
48
48
  torch.save(model.state_dict(), save_path)
49
49
  print(f"Model saved to {save_path}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: oikan
3
- Version: 0.0.1.9
3
+ Version: 0.0.1.10
4
4
  Summary: OIKAN: Optimized Interpretable Kolmogorov-Arnold Networks
5
5
  Author: Arman Zhalgasbayev
6
6
  License: MIT
@@ -3,11 +3,11 @@ oikan/metrics.py,sha256=65txPbjhTz7lCXCLtTAJTS4E5Hx42wzZ3jKar3lH_bY,860
3
3
  oikan/model.py,sha256=zlw_4HbSK3IiQhE8M4NitvrXa7vffBWsOR-HLRSJADA,3944
4
4
  oikan/regularization.py,sha256=xt8JNnPdHRAQgzF_vnyme005hWLunz9Vo2qw6m08NMM,1145
5
5
  oikan/symbolic.py,sha256=RRYHOCOCJr5KXRhdcCPvT_OqyNcCnWCWt7fOtos8rRI,5765
6
- oikan/trainer.py,sha256=M7F5FLCXB5HUKhMRJiX92o0DB9NHWZIb25bGgyYwXrM,1986
6
+ oikan/trainer.py,sha256=PwA8PnVUiv5wYlQqj3DTplCAUZljZ4iWJUKUDvmIvX0,2062
7
7
  oikan/utils.py,sha256=xbVgrbhXYj57RdD3uNPchjyfmP6Kur7tngoZPa3qWOw,2094
8
8
  oikan/visualize.py,sha256=sA__nLB35y6tuWDAM3aoC7VezxJAvdSlwzmoPfrnFhQ,2249
9
- oikan-0.0.1.9.dist-info/LICENSE,sha256=75ASVmU-XIpN-M4LbVmJ_ibgbzbvRLVti8FhnR0BTf8,1096
10
- oikan-0.0.1.9.dist-info/METADATA,sha256=ZyH9i_F8ymdalTVQxVbyyEFUa0xPLt7byLXP5zVfjO0,3847
11
- oikan-0.0.1.9.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
12
- oikan-0.0.1.9.dist-info/top_level.txt,sha256=XwnwKwTJddZwIvtrUsAz-l-58BJRj6HjAGWrfYi_3QY,6
13
- oikan-0.0.1.9.dist-info/RECORD,,
9
+ oikan-0.0.1.10.dist-info/LICENSE,sha256=75ASVmU-XIpN-M4LbVmJ_ibgbzbvRLVti8FhnR0BTf8,1096
10
+ oikan-0.0.1.10.dist-info/METADATA,sha256=Mzmf6JP3taLsxytaSz8TI30M-uvmaq7jcEkZORGCatw,3848
11
+ oikan-0.0.1.10.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
12
+ oikan-0.0.1.10.dist-info/top_level.txt,sha256=XwnwKwTJddZwIvtrUsAz-l-58BJRj6HjAGWrfYi_3QY,6
13
+ oikan-0.0.1.10.dist-info/RECORD,,