yms-kan 0.0.3__tar.gz → 0.0.5__tar.gz

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.
Files changed (28) hide show
  1. {yms_kan-0.0.3/yms_kan.egg-info → yms_kan-0.0.5}/PKG-INFO +1 -1
  2. {yms_kan-0.0.3 → yms_kan-0.0.5}/yms_kan/train_eval_utils.py +3 -19
  3. yms_kan-0.0.5/yms_kan/version.py +1 -0
  4. {yms_kan-0.0.3 → yms_kan-0.0.5/yms_kan.egg-info}/PKG-INFO +1 -1
  5. yms_kan-0.0.3/yms_kan/version.py +0 -1
  6. {yms_kan-0.0.3 → yms_kan-0.0.5}/LICENSE +0 -0
  7. {yms_kan-0.0.3 → yms_kan-0.0.5}/MANIFEST.in +0 -0
  8. {yms_kan-0.0.3 → yms_kan-0.0.5}/README.md +0 -0
  9. {yms_kan-0.0.3 → yms_kan-0.0.5}/pyproject.toml +0 -0
  10. {yms_kan-0.0.3 → yms_kan-0.0.5}/setup.cfg +0 -0
  11. {yms_kan-0.0.3 → yms_kan-0.0.5}/yms_kan/KANLayer.py +0 -0
  12. {yms_kan-0.0.3 → yms_kan-0.0.5}/yms_kan/LBFGS.py +0 -0
  13. {yms_kan-0.0.3 → yms_kan-0.0.5}/yms_kan/MLP.py +0 -0
  14. {yms_kan-0.0.3 → yms_kan-0.0.5}/yms_kan/MultKAN.py +0 -0
  15. {yms_kan-0.0.3 → yms_kan-0.0.5}/yms_kan/Symbolic_KANLayer.py +0 -0
  16. {yms_kan-0.0.3 → yms_kan-0.0.5}/yms_kan/__init__.py +0 -0
  17. {yms_kan-0.0.3 → yms_kan-0.0.5}/yms_kan/assets/img/mult_symbol.png +0 -0
  18. {yms_kan-0.0.3 → yms_kan-0.0.5}/yms_kan/assets/img/sum_symbol.png +0 -0
  19. {yms_kan-0.0.3 → yms_kan-0.0.5}/yms_kan/compiler.py +0 -0
  20. {yms_kan-0.0.3 → yms_kan-0.0.5}/yms_kan/experiment.py +0 -0
  21. {yms_kan-0.0.3 → yms_kan-0.0.5}/yms_kan/feynman.py +0 -0
  22. {yms_kan-0.0.3 → yms_kan-0.0.5}/yms_kan/hypothesis.py +0 -0
  23. {yms_kan-0.0.3 → yms_kan-0.0.5}/yms_kan/spline.py +0 -0
  24. {yms_kan-0.0.3 → yms_kan-0.0.5}/yms_kan/tool.py +0 -0
  25. {yms_kan-0.0.3 → yms_kan-0.0.5}/yms_kan/utils.py +0 -0
  26. {yms_kan-0.0.3 → yms_kan-0.0.5}/yms_kan.egg-info/SOURCES.txt +0 -0
  27. {yms_kan-0.0.3 → yms_kan-0.0.5}/yms_kan.egg-info/dependency_links.txt +0 -0
  28. {yms_kan-0.0.3 → yms_kan-0.0.5}/yms_kan.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yms_kan
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: My awesome package
5
5
  Author-email: yms <11@qq.com>
6
6
  License-Expression: MIT
@@ -5,27 +5,11 @@ import sys
5
5
  import numpy as np
6
6
  import torch
7
7
  from matplotlib import pyplot as plt
8
- from sklearn.metrics import classification_report
9
8
  from torch.optim.lr_scheduler import ReduceLROnPlateau
10
9
  from tqdm import tqdm
11
10
 
12
11
  from yms_kan import LBFGS
13
- from yms_kan.tool import initialize_results_file, append_to_results_file
14
-
15
-
16
- def calculate_metric(all_labels, all_predictions, classes, class_metric=False, average='macro avg'):
17
- metric = classification_report(y_true=all_labels, y_pred=all_predictions,
18
- target_names=classes, digits=4, output_dict=True, zero_division=0)
19
- if not class_metric:
20
- metric = {
21
- 'accuracy': metric.get('accuracy'),
22
- 'precision': metric.get(average).get('precision'),
23
- 'recall': metric.get(average).get('recall'),
24
- 'f1-score': metric.get(average).get('f1-score'),
25
- }
26
- return metric
27
- else:
28
- return metric
12
+ from yms_kan.tool import initialize_results_file, append_to_results_file, calculate_metric
29
13
 
30
14
 
31
15
  def train_val(model, dataset: dict, batch_size, batch_size_test, save_path, txt_file=None, opt="LBFGS", epochs=100,
@@ -72,7 +56,7 @@ def train_val(model, dataset: dict, batch_size, batch_size_test, save_path, txt_
72
56
  lr_scheduler = ReduceLROnPlateau(optimizer, mode='min', factor=0.1, patience=5, min_lr=1e-9)
73
57
 
74
58
  results = {'train_losses': [], 'val_losses': [], 'accuracies': [], 'precisions': [], 'recalls': [], 'f1-scores': [],
75
- 'lrs': [], 'all_predictions': [], 'all_labels': []}
59
+ 'lrs': [], 'all_predictions': [], 'all_labels': [], 'regularize': []}
76
60
 
77
61
  steps = math.ceil(dataset['train_input'].shape[0] / batch_size)
78
62
 
@@ -177,7 +161,7 @@ def train_val(model, dataset: dict, batch_size, batch_size_test, save_path, txt_
177
161
  if label is not None:
178
162
  m = calculate_metric(all_labels, all_predictions, class_dict)
179
163
  print(m)
180
- results["accuracy"].append(m["accuracy"])
164
+ results["accuracies"].append(m["accuracy"])
181
165
  results["precisions"].append(m["precision"])
182
166
  results["recalls"].append(m["recall"])
183
167
  results["f1-scores"].append(m["f1-score"])
@@ -0,0 +1 @@
1
+ __version__ = "0.0.5" # 初始版本
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yms_kan
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: My awesome package
5
5
  Author-email: yms <11@qq.com>
6
6
  License-Expression: MIT
@@ -1 +0,0 @@
1
- __version__ = "0.0.3" # 初始版本
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes