pyerualjetwork 4.1.4__tar.gz → 4.1.6__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. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/PKG-INFO +35 -10
  2. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/README.md +35 -10
  3. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork/__init__.py +5 -4
  4. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork/activation_functions_cuda.py +1 -1
  5. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork/data_operations.py +41 -80
  6. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork/data_operations_cuda.py +48 -92
  7. pyerualjetwork-4.1.6/pyerualjetwork/memory_operations.py +303 -0
  8. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork/metrics_cuda.py +3 -4
  9. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork/model_operations.py +4 -5
  10. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork/model_operations_cuda.py +7 -6
  11. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork/plan.py +35 -23
  12. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork/plan_cuda.py +113 -81
  13. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork/visualizations.py +147 -125
  14. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork/visualizations_cuda.py +193 -169
  15. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork.egg-info/PKG-INFO +35 -10
  16. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork.egg-info/SOURCES.txt +1 -0
  17. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/setup.py +1 -1
  18. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork/activation_functions.py +0 -0
  19. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork/help.py +0 -0
  20. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork/loss_functions.py +0 -0
  21. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork/loss_functions_cuda.py +0 -0
  22. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork/metrics.py +0 -0
  23. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork/planeat.py +0 -0
  24. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork/planeat_cuda.py +0 -0
  25. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork/ui.py +0 -0
  26. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork.egg-info/dependency_links.txt +0 -0
  27. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/pyerualjetwork.egg-info/top_level.txt +0 -0
  28. {pyerualjetwork-4.1.4 → pyerualjetwork-4.1.6}/setup.cfg +0 -0
@@ -1,17 +1,26 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyerualjetwork
3
- Version: 4.1.4
3
+ Version: 4.1.6
4
4
  Summary: PyerualJetwork is a machine learning library written in Python for professionals, incorporating advanced, unique, new, and modern techniques.
5
5
  Author: Hasan Can Beydili
6
6
  Author-email: tchasancan@gmail.com
7
7
  Keywords: model evaluation,classification,potentiation learning artificial neural networks,NEAT,genetic algorithms,reinforcement learning,neural networks
8
8
  Description-Content-Type: text/markdown
9
9
 
10
- # PyerualJetwork [![Socket Badge](https://socket.dev/api/badge/pypi/package/pyerualjetwork/4.0.6?artifact_id=tar-gz)](https://socket.dev/pypi/package/pyerualjetwork/overview/4.0.6/tar-gz) [![CodeFactor](https://www.codefactor.io/repository/github/hcb06/pyerualjetwork/badge)](https://www.codefactor.io/repository/github/hcb06/pyerualjetwork) [![PyPI Downloads](https://static.pepy.tech/badge/anaplan)](https://pepy.tech/projects/anaplan) + [![PyPI Downloads](https://static.pepy.tech/badge/pyerualjetwork)](https://pepy.tech/projects/pyerualjetwork) [![PyPI Downloads](https://static.pepy.tech/badge/pyerualjetwork/month)](https://pepy.tech/projects/pyerualjetwork) [![PyPI Downloads](https://static.pepy.tech/badge/pyerualjetwork/week)](https://pepy.tech/projects/pyerualjetwork) [![PyPI version](https://img.shields.io/pypi/v/pyerualjetwork.svg)](https://pypi.org/project/pyerualjetwork/)
10
+ # PyerualJetwork [![Socket Badge](https://socket.dev/api/badge/pypi/package/pyerualjetwork/4.0.6?artifact_id=tar-gz)](https://socket.dev/pypi/package/pyerualjetwork/overview/4.0.6/tar-gz) [![CodeFactor](https://www.codefactor.io/repository/github/hcb06/pyerualjetwork/badge)](https://www.codefactor.io/repository/github/hcb06/pyerualjetwork) [![PyPI Downloads](https://static.pepy.tech/badge/pyerualjetwork)](https://pepy.tech/projects/pyerualjetwork) + [![PyPI Downloads](https://static.pepy.tech/badge/anaplan)](https://pepy.tech/projects/anaplan)
11
+
12
+
13
+ [![PyPI Downloads](https://static.pepy.tech/badge/pyerualjetwork/month)](https://pepy.tech/projects/pyerualjetwork) [![PyPI Downloads](https://static.pepy.tech/badge/pyerualjetwork/week)](https://pepy.tech/projects/pyerualjetwork) [![PyPI version](https://img.shields.io/pypi/v/pyerualjetwork.svg)](https://pypi.org/project/pyerualjetwork/)
11
14
 
12
15
  Note: anaplan old name of pyerualjetwork
13
16
 
14
- https://libraries.io/pypi/pyerualjetwork
17
+ ![PyerualJetwork](https://github.com/HCB06/PyerualJetwork/blob/main/Media/pyerualjetwork_with_name.png)<br><br><br>
18
+
19
+ Libraries.io Page: https://libraries.io/pypi/pyerualjetwork
20
+
21
+ PyPi Page: https://pypi.org/project/pyerualjetwork/
22
+
23
+ GitHub Page: https://github.com/HCB06/PyerualJetwork
15
24
 
16
25
 
17
26
  pip install pyerualjetwork
@@ -29,7 +38,7 @@ https://libraries.io/pypi/pyerualjetwork
29
38
  Optimized for Visual Studio Code
30
39
 
31
40
  requires=[
32
- 'setuptools==75.6.0'
41
+ 'setuptools==75.6.0',
33
42
  'scipy==1.13.1',
34
43
  'tqdm==4.66.4',
35
44
  'seaborn==0.13.2',
@@ -38,27 +47,31 @@ https://libraries.io/pypi/pyerualjetwork
38
47
  'numpy==1.26.4',
39
48
  'matplotlib==3.9.0',
40
49
  'colorama==0.4.6',
41
- 'cupy-cuda12x'
50
+ 'cupy-cuda12x',
51
+ 'psutil==6.1.1'
42
52
  ]
43
53
 
44
54
  matplotlib, seaborn, networkx (optional).
45
- PyerualJetwork checks and install all dependencies (with optional ones but except cupy) for every runing.
55
+ PyerualJetwork checks and install all dependencies with optional ones for every runing.
46
56
  If your version is higher or lower, PyerualJetwork automaticly delete other versions and installs this versions.
47
57
 
48
58
  ##############################
49
59
 
50
60
  ABOUT PYERUALJETWORK:
51
61
 
52
- PyerualJetwork is a machine learning library written in Python for professionals, incorporating advanced, unique, new, and modern techniques. Its most important component is the PLAN (Potentiation Learning Artificial Neural Network) https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4862342. (THIS ARTICLE IS FIRST VERSION OF PLAN.) MODERN VERSION OF PLAN: https://github.com/HCB06/PyerualJetwork/blob/main/Welcome_to_PLAN/PLAN.pdf
62
+ PyerualJetwork is a machine learning library written in Python for professionals, incorporating advanced, unique, new, and modern techniques with optimized GPU acceleration. Its most important component is the PLAN (Potentiation Learning Artificial Neural Network) https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4862342. (THIS ARTICLE IS FIRST VERSION OF PLAN.) MODERN VERSION OF PLAN: https://github.com/HCB06/PyerualJetwork/blob/main/Welcome_to_PLAN/PLAN.pdf
53
63
  Both the PLAN algorithm and the PyerualJetwork library were created by Author, and all rights are reserved by Author.
54
64
  PyerualJetwork is free to use for commercial business and individual users. PyerualJetwork is written in fully functional programming with non-oop elements. PyerualJetwork consists of many functions that complement each other, which facilitates the learning process and debugging during use.
55
65
  As of 12/21/2024, the library includes PLAN and PLANEAT module, but other machine learning modules are expected to be added in the future.
66
+
67
+ PyerualJetwork ready for both eager execution(like PyTorch) and static graph(like Tensorflow) concepts because PyerualJetwork using only functions.
68
+ For example:
69
+
70
+ fit function only fits given training data(suitable for dynamic graph) but learner function learns and optimize entire architecture(suitable for static graph). Or more deeper eager executions PyerualJetwork have: feed_forward function, list of activation functions, loss functions. You can create your unique model architecture. Move your data to GPU or CPU or manage how much should in GPU, Its all up to you.
56
71
  <br><br>
57
72
 
58
73
  PyerualJetworket includes Plan Vision, NLPlan, PLANEAT and at the between of both, Deep Plan.<br>
59
74
 
60
- ![PyerualJetwork](https://github.com/HCB06/PyerualJetwork/blob/main/Media/anaplanet_logo_final.png)<br><br><br>
61
-
62
75
  PLAN VISION:<br>
63
76
 
64
77
  ![PLAN VISION](https://github.com/HCB06/PyerualJetwork/blob/main/Media/PlanVision.jpg)
@@ -82,8 +95,20 @@ PLANEAT:<br>
82
95
  You can create artificial intelligence models that perform reinforcement learning tasks and genetic optimization tasks using the planeat module:
83
96
 
84
97
  ![PLANEAT](https://github.com/HCB06/PyerualJetwork/blob/main/Media/PLANEAT_1.gif)<br>
85
-
86
98
  ![PLANEAT](https://github.com/HCB06/PyerualJetwork/blob/main/Media/PLANEAT_2.gif)<br>
99
+ ![PLANEAT](https://github.com/HCB06/PyerualJetwork/blob/main/Media/mario.gif)<br><br>
100
+
101
+ YOU CAN CREATE DYNAMIC ANIMATIONS OF YOUR MODELS
102
+
103
+ ![VISUALIZATIONS](https://github.com/HCB06/PyerualJetwork/blob/main/Media/fit_history.gif)<br>
104
+ ![VISUALIZATIONS](https://github.com/HCB06/PyerualJetwork/blob/main/Media/neuron_history.gif)<br>
105
+ ![VISUALIZATIONS](https://github.com/HCB06/PyerualJetwork/blob/main/Media/neural_web.gif)<br>
106
+
107
+ YOU CAN CREATE AND VISUALIZE YOUR MODEL ARCHITECTURE
108
+
109
+ ![VISUALIZATIONS](https://github.com/HCB06/PyerualJetwork/blob/main/Media/model_arc.png)<br>
110
+ ![VISUALIZATIONS](https://github.com/HCB06/PyerualJetwork/blob/main/Media/eval_metrics.png)<br>
111
+
87
112
 
88
113
 
89
114
  HOW DO I IMPORT IT TO MY PROJECT?
@@ -1,8 +1,17 @@
1
- # PyerualJetwork [![Socket Badge](https://socket.dev/api/badge/pypi/package/pyerualjetwork/4.0.6?artifact_id=tar-gz)](https://socket.dev/pypi/package/pyerualjetwork/overview/4.0.6/tar-gz) [![CodeFactor](https://www.codefactor.io/repository/github/hcb06/pyerualjetwork/badge)](https://www.codefactor.io/repository/github/hcb06/pyerualjetwork) [![PyPI Downloads](https://static.pepy.tech/badge/anaplan)](https://pepy.tech/projects/anaplan) + [![PyPI Downloads](https://static.pepy.tech/badge/pyerualjetwork)](https://pepy.tech/projects/pyerualjetwork) [![PyPI Downloads](https://static.pepy.tech/badge/pyerualjetwork/month)](https://pepy.tech/projects/pyerualjetwork) [![PyPI Downloads](https://static.pepy.tech/badge/pyerualjetwork/week)](https://pepy.tech/projects/pyerualjetwork) [![PyPI version](https://img.shields.io/pypi/v/pyerualjetwork.svg)](https://pypi.org/project/pyerualjetwork/)
1
+ # PyerualJetwork [![Socket Badge](https://socket.dev/api/badge/pypi/package/pyerualjetwork/4.0.6?artifact_id=tar-gz)](https://socket.dev/pypi/package/pyerualjetwork/overview/4.0.6/tar-gz) [![CodeFactor](https://www.codefactor.io/repository/github/hcb06/pyerualjetwork/badge)](https://www.codefactor.io/repository/github/hcb06/pyerualjetwork) [![PyPI Downloads](https://static.pepy.tech/badge/pyerualjetwork)](https://pepy.tech/projects/pyerualjetwork) + [![PyPI Downloads](https://static.pepy.tech/badge/anaplan)](https://pepy.tech/projects/anaplan)
2
+
3
+
4
+ [![PyPI Downloads](https://static.pepy.tech/badge/pyerualjetwork/month)](https://pepy.tech/projects/pyerualjetwork) [![PyPI Downloads](https://static.pepy.tech/badge/pyerualjetwork/week)](https://pepy.tech/projects/pyerualjetwork) [![PyPI version](https://img.shields.io/pypi/v/pyerualjetwork.svg)](https://pypi.org/project/pyerualjetwork/)
2
5
 
3
6
  Note: anaplan old name of pyerualjetwork
4
7
 
5
- https://libraries.io/pypi/pyerualjetwork
8
+ ![PyerualJetwork](https://github.com/HCB06/PyerualJetwork/blob/main/Media/pyerualjetwork_with_name.png)<br><br><br>
9
+
10
+ Libraries.io Page: https://libraries.io/pypi/pyerualjetwork
11
+
12
+ PyPi Page: https://pypi.org/project/pyerualjetwork/
13
+
14
+ GitHub Page: https://github.com/HCB06/PyerualJetwork
6
15
 
7
16
 
8
17
  pip install pyerualjetwork
@@ -20,7 +29,7 @@ https://libraries.io/pypi/pyerualjetwork
20
29
  Optimized for Visual Studio Code
21
30
 
22
31
  requires=[
23
- 'setuptools==75.6.0'
32
+ 'setuptools==75.6.0',
24
33
  'scipy==1.13.1',
25
34
  'tqdm==4.66.4',
26
35
  'seaborn==0.13.2',
@@ -29,27 +38,31 @@ https://libraries.io/pypi/pyerualjetwork
29
38
  'numpy==1.26.4',
30
39
  'matplotlib==3.9.0',
31
40
  'colorama==0.4.6',
32
- 'cupy-cuda12x'
41
+ 'cupy-cuda12x',
42
+ 'psutil==6.1.1'
33
43
  ]
34
44
 
35
45
  matplotlib, seaborn, networkx (optional).
36
- PyerualJetwork checks and install all dependencies (with optional ones but except cupy) for every runing.
46
+ PyerualJetwork checks and install all dependencies with optional ones for every runing.
37
47
  If your version is higher or lower, PyerualJetwork automaticly delete other versions and installs this versions.
38
48
 
39
49
  ##############################
40
50
 
41
51
  ABOUT PYERUALJETWORK:
42
52
 
43
- PyerualJetwork is a machine learning library written in Python for professionals, incorporating advanced, unique, new, and modern techniques. Its most important component is the PLAN (Potentiation Learning Artificial Neural Network) https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4862342. (THIS ARTICLE IS FIRST VERSION OF PLAN.) MODERN VERSION OF PLAN: https://github.com/HCB06/PyerualJetwork/blob/main/Welcome_to_PLAN/PLAN.pdf
53
+ PyerualJetwork is a machine learning library written in Python for professionals, incorporating advanced, unique, new, and modern techniques with optimized GPU acceleration. Its most important component is the PLAN (Potentiation Learning Artificial Neural Network) https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4862342. (THIS ARTICLE IS FIRST VERSION OF PLAN.) MODERN VERSION OF PLAN: https://github.com/HCB06/PyerualJetwork/blob/main/Welcome_to_PLAN/PLAN.pdf
44
54
  Both the PLAN algorithm and the PyerualJetwork library were created by Author, and all rights are reserved by Author.
45
55
  PyerualJetwork is free to use for commercial business and individual users. PyerualJetwork is written in fully functional programming with non-oop elements. PyerualJetwork consists of many functions that complement each other, which facilitates the learning process and debugging during use.
46
56
  As of 12/21/2024, the library includes PLAN and PLANEAT module, but other machine learning modules are expected to be added in the future.
57
+
58
+ PyerualJetwork ready for both eager execution(like PyTorch) and static graph(like Tensorflow) concepts because PyerualJetwork using only functions.
59
+ For example:
60
+
61
+ fit function only fits given training data(suitable for dynamic graph) but learner function learns and optimize entire architecture(suitable for static graph). Or more deeper eager executions PyerualJetwork have: feed_forward function, list of activation functions, loss functions. You can create your unique model architecture. Move your data to GPU or CPU or manage how much should in GPU, Its all up to you.
47
62
  <br><br>
48
63
 
49
64
  PyerualJetworket includes Plan Vision, NLPlan, PLANEAT and at the between of both, Deep Plan.<br>
50
65
 
51
- ![PyerualJetwork](https://github.com/HCB06/PyerualJetwork/blob/main/Media/anaplanet_logo_final.png)<br><br><br>
52
-
53
66
  PLAN VISION:<br>
54
67
 
55
68
  ![PLAN VISION](https://github.com/HCB06/PyerualJetwork/blob/main/Media/PlanVision.jpg)
@@ -73,8 +86,20 @@ PLANEAT:<br>
73
86
  You can create artificial intelligence models that perform reinforcement learning tasks and genetic optimization tasks using the planeat module:
74
87
 
75
88
  ![PLANEAT](https://github.com/HCB06/PyerualJetwork/blob/main/Media/PLANEAT_1.gif)<br>
76
-
77
89
  ![PLANEAT](https://github.com/HCB06/PyerualJetwork/blob/main/Media/PLANEAT_2.gif)<br>
90
+ ![PLANEAT](https://github.com/HCB06/PyerualJetwork/blob/main/Media/mario.gif)<br><br>
91
+
92
+ YOU CAN CREATE DYNAMIC ANIMATIONS OF YOUR MODELS
93
+
94
+ ![VISUALIZATIONS](https://github.com/HCB06/PyerualJetwork/blob/main/Media/fit_history.gif)<br>
95
+ ![VISUALIZATIONS](https://github.com/HCB06/PyerualJetwork/blob/main/Media/neuron_history.gif)<br>
96
+ ![VISUALIZATIONS](https://github.com/HCB06/PyerualJetwork/blob/main/Media/neural_web.gif)<br>
97
+
98
+ YOU CAN CREATE AND VISUALIZE YOUR MODEL ARCHITECTURE
99
+
100
+ ![VISUALIZATIONS](https://github.com/HCB06/PyerualJetwork/blob/main/Media/model_arc.png)<br>
101
+ ![VISUALIZATIONS](https://github.com/HCB06/PyerualJetwork/blob/main/Media/eval_metrics.png)<br>
102
+
78
103
 
79
104
 
80
105
  HOW DO I IMPORT IT TO MY PROJECT?
@@ -83,4 +108,4 @@ Anaconda users can access the 'Anaconda Prompt' terminal from the Start menu and
83
108
 
84
109
  After installing the module using "pip" you can now call the library module in your project environment. Use: “from pyerualjetwork import plan”. Now, you can call the necessary functions from the plan module.
85
110
 
86
- The PLAN algorithm will not be explained in this document. This document focuses on how professionals can integrate and use PyerualJetwork in their systems. However, briefly, the PLAN algorithm can be described as a classification algorithm. PLAN algorithm achieves this task with an incredibly energy-efficient, fast, and hyperparameter-free user-friendly approach. For more detailed information, you can check out ![PYERUALJETWORK USER MANUEL](https://github.com/HCB06/PyerualJetwork/blob/main/Welcome_to_PyerualJetwork/PYERUALJETWORK_USER_MANUEL_AND_LEGAL_INFORMATION(EN).pdf) file.
111
+ The PLAN algorithm will not be explained in this document. This document focuses on how professionals can integrate and use PyerualJetwork in their systems. However, briefly, the PLAN algorithm can be described as a classification algorithm. PLAN algorithm achieves this task with an incredibly energy-efficient, fast, and hyperparameter-free user-friendly approach. For more detailed information, you can check out ![PYERUALJETWORK USER MANUEL](https://github.com/HCB06/PyerualJetwork/blob/main/Welcome_to_PyerualJetwork/PYERUALJETWORK_USER_MANUEL_AND_LEGAL_INFORMATION(EN).pdf) file.
@@ -2,7 +2,6 @@
2
2
  import subprocess
3
3
  subprocess.check_call(["pip", "install", 'setuptools==75.6.0'])
4
4
  import pkg_resources
5
- from datetime import datetime
6
5
 
7
6
  print("Auto checking and installation dependencies for PyerualJetwork")
8
7
 
@@ -14,7 +13,9 @@ package_names = [
14
13
  'networkx==3.3',
15
14
  'numpy==1.26.4',
16
15
  'matplotlib==3.9.0',
17
- 'colorama==0.4.6'
16
+ 'colorama==0.4.6',
17
+ 'psutil==6.1.1',
18
+ 'cupy-cuda12x==13.3.0'
18
19
  ]
19
20
 
20
21
  installed_packages = pkg_resources.working_set
@@ -47,8 +48,8 @@ for package_name in package_names:
47
48
 
48
49
  print(f"PyerualJetwork is ready to use with {err} errors")
49
50
 
50
- __version__ = "4.1.4"
51
- __update__ = "* Note: CUDA modules need cupy. Enter this command in your terminal: 'pip install cupy-cuda12x' or your cuda version.\n* Changes: https://github.com/HCB06/PyerualJetwork/blob/main/CHANGES\n* PyerualJetwork document: https://github.com/HCB06/Anaplan/blob/main/Welcome_to_PyerualJetwork/PYERUALJETWORK_USER_MANUEL_AND_LEGAL_INFORMATION(EN).pdf\n* YouTube tutorials: https://www.youtube.com/@HasanCanBeydili"
51
+ __version__ = "4.1.6"
52
+ __update__ = "* Changes: https://github.com/HCB06/PyerualJetwork/blob/main/CHANGES\n* PyerualJetwork document: https://github.com/HCB06/PyerualJetwork/blob/main/Welcome_to_PyerualJetwork/PYERUALJETWORK_USER_MANUEL_AND_LEGAL_INFORMATION(EN).pdf\n* YouTube tutorials: https://www.youtube.com/@HasanCanBeydili"
52
53
 
53
54
  def print_version(__version__):
54
55
  print(f"PyerualJetwork Version {__version__}" + '\n')
@@ -37,7 +37,7 @@ def Softmax(
37
37
  Returns:
38
38
  (num): Transformed data after applying softmax function.
39
39
  """
40
-
40
+
41
41
  return cp.array(softmax(x.get()))
42
42
 
43
43
 
@@ -16,26 +16,10 @@ def encode_one_hot(y_train, y_test=None, summary=False):
16
16
  Returns:
17
17
  tuple: One-hot encoded y_train and (if given) y_test.
18
18
  """
19
- if len(y_train) < 256:
20
- if y_train.dtype != np.uint8:
21
- y_train = np.array(y_train, copy=False).astype(np.uint8, copy=False)
22
- elif len(y_train) <= 32767:
23
- if y_train.dtype != np.uint16:
24
- y_train = np.array(y_train, copy=False).astype(np.uint16, copy=False)
25
- else:
26
- if y_train.dtype != np.uint32:
27
- y_train = np.array(y_train, copy=False).astype(np.uint32, copy=False)
28
-
29
- if y_test is not None:
30
- if len(y_test) < 256:
31
- if y_test.dtype != np.uint8:
32
- y_test = np.array(y_test, copy=False).astype(np.uint8, copy=False)
33
- elif len(y_test) <= 32767:
34
- if y_test.dtype != np.uint16:
35
- y_test = np.array(y_test, copy=False).astype(np.uint16, copy=False)
36
- else:
37
- if y_test.dtype != np.uint32:
38
- y_test = np.array(y_test, copy=False).astype(np.uint32, copy=False)
19
+ from .memory_operations import optimize_labels
20
+
21
+ y_train = optimize_labels(y_train, one_hot_encoded=False, cuda=False)
22
+ y_test = optimize_labels(y_test, one_hot_encoded=False, cuda=False)
39
23
 
40
24
  classes = np.unique(y_train)
41
25
  class_count = len(classes)
@@ -47,12 +31,12 @@ def encode_one_hot(y_train, y_test=None, summary=False):
47
31
  for cls, idx in class_to_index.items():
48
32
  print(f" {idx}: {cls}")
49
33
 
50
- y_train_encoded = np.zeros((y_train.shape[0], class_count))
34
+ y_train_encoded = np.zeros((y_train.shape[0], class_count), dtype=y_train.dtype)
51
35
  for i, label in enumerate(y_train):
52
36
  y_train_encoded[i, class_to_index[label]] = 1
53
37
 
54
38
  if y_test is not None:
55
- y_test_encoded = np.zeros((y_test.shape[0], class_count))
39
+ y_test_encoded = np.zeros((y_test.shape[0], class_count), dtype=y_test.dtype)
56
40
  for i, label in enumerate(y_test):
57
41
  y_test_encoded[i, class_to_index[label]] = 1
58
42
  return y_train_encoded, y_test_encoded
@@ -90,16 +74,10 @@ def split(X, y, test_size, random_state=42, dtype=np.float32):
90
74
  Returns:
91
75
  tuple: x_train, x_test, y_train, y_test as ordered training and testing data subsets.
92
76
  """
93
- X = X.astype(dtype)
94
- if len(y) < 256:
95
- if y.dtype != np.uint8:
96
- y = np.array(y, copy=False).astype(np.uint8, copy=False)
97
- elif len(y) <= 32767:
98
- if y.dtype != np.uint16:
99
- y = np.array(y, copy=False).astype(np.uint16, copy=False)
100
- else:
101
- if y.dtype != np.uint32:
102
- y = np.array(y, copy=False).astype(np.uint32, copy=False)
77
+ from .memory_operations import transfer_to_cpu, optimize_labels
78
+
79
+ X = transfer_to_cpu(X, dtype=dtype)
80
+ y = optimize_labels(y, one_hot_encoded=False, cuda=False)
103
81
 
104
82
  num_samples = X.shape[0]
105
83
 
@@ -124,6 +102,8 @@ def split(X, y, test_size, random_state=42, dtype=np.float32):
124
102
  x_train, x_test = X[train_indices], X[test_indices]
125
103
  y_train, y_test = y[train_indices], y[test_indices]
126
104
 
105
+ del X, y
106
+
127
107
  return x_train, x_test, y_train, y_test
128
108
 
129
109
 
@@ -142,20 +122,11 @@ def manuel_balancer(x_train, y_train, target_samples_per_class, dtype=np.float32
142
122
  y_balanced -- Balanced class labels (one-hot encoded, NumPy array format)
143
123
  """
144
124
  from .ui import loading_bars
145
-
146
- bar_format = loading_bars()[0]
125
+ from .memory_operations import transfer_to_cpu
147
126
 
148
- x_train = np.array(x_train, copy=False).astype(dtype, copy=False)
149
- if len(y_train[0]) < 256:
150
- if y_train.dtype != np.uint8:
151
- y_train = np.array(y_train, copy=False).astype(np.uint8, copy=False)
152
- elif len(y_train[0]) <= 32767:
153
- if y_train.dtype != np.uint16:
154
- y_train = np.array(y_train, copy=False).astype(np.uint16, copy=False)
155
- else:
156
- if y_train.dtype != np.uint32:
157
- y_train = np.array(y_train, copy=False).astype(np.uint32, copy=False)
127
+ x_train = transfer_to_cpu(x_train, dtype=dtype)
158
128
 
129
+ bar_format = loading_bars()[0]
159
130
  classes = np.arange(y_train.shape[1])
160
131
  class_count = len(classes)
161
132
 
@@ -181,8 +152,8 @@ def manuel_balancer(x_train, y_train, target_samples_per_class, dtype=np.float32
181
152
  if num_samples < target_samples_per_class:
182
153
 
183
154
  samples_to_add = target_samples_per_class - num_samples
184
- additional_samples = np.zeros((samples_to_add, x_train.shape[1]))
185
- additional_labels = np.zeros((samples_to_add, y_train.shape[1]))
155
+ additional_samples = np.zeros((samples_to_add, x_train.shape[1]), dtype=x_train.dtype)
156
+ additional_labels = np.zeros((samples_to_add, y_train.shape[1]), dtype=y_train.dtype)
186
157
 
187
158
  for i in range(samples_to_add):
188
159
 
@@ -200,10 +171,12 @@ def manuel_balancer(x_train, y_train, target_samples_per_class, dtype=np.float32
200
171
  x_balanced.append(additional_samples)
201
172
  y_balanced.append(additional_labels)
202
173
 
203
- x_balanced = np.vstack(x_balanced)
204
- y_balanced = np.vstack(y_balanced)
174
+ x_balanced = np.vstack(x_balanced, dtype=x_train.dtype)
175
+ y_balanced = np.vstack(y_balanced, dtype=y_train.dtype)
176
+
177
+ del x_train, y_train
205
178
 
206
- return x_balanced.astype(dtype), y_balanced.astype(dtype)
179
+ return x_balanced, y_balanced
207
180
 
208
181
 
209
182
  def auto_balancer(x_train, y_train, dtype=np.float32):
@@ -220,20 +193,11 @@ def auto_balancer(x_train, y_train, dtype=np.float32):
220
193
  tuple: A tuple containing balanced input data and labels.
221
194
  """
222
195
  from .ui import loading_bars
223
-
224
- bar_format = loading_bars()[0]
196
+ from .memory_operations import transfer_to_cpu
225
197
 
226
- x_train = np.array(x_train, copy=False).astype(dtype, copy=False)
227
- if len(y_train[0]) < 256:
228
- if y_train.dtype != np.uint8:
229
- y_train = np.array(y_train, copy=False).astype(np.uint8, copy=False)
230
- elif len(y_train[0]) <= 32767:
231
- if y_train.dtype != np.uint16:
232
- y_train = np.array(y_train, copy=False).astype(np.uint16, copy=False)
233
- else:
234
- if y_train.dtype != np.uint32:
235
- y_train = np.array(y_train, copy=False).astype(np.uint32, copy=False)
198
+ x_train = transfer_to_cpu(x_train, dtype=dtype)
236
199
 
200
+ bar_format = loading_bars()[0]
237
201
  classes = np.arange(y_train.shape[1])
238
202
  class_count = len(classes)
239
203
 
@@ -271,10 +235,15 @@ def auto_balancer(x_train, y_train, dtype=np.float32):
271
235
  print(Fore.RED + "ERROR: Inputs and labels must be same length check parameters")
272
236
  sys.exit()
273
237
 
274
- return BalancedInputs.astype(dtype, copy=False), BalancedLabels.astype(dtype, copy=False)
238
+ BalancedInputs = BalancedInputs.astype(dtype, copy=False)
239
+ BalancedLabels = BalancedLabels.astype(dtype=y_train.dtype, copy=False)
275
240
 
241
+ del x_train, y_train
276
242
 
277
- def synthetic_augmentation(x_train, y_train, dtype=np.float32):
243
+ return BalancedInputs, BalancedLabels
244
+
245
+
246
+ def synthetic_augmentation(x, y, dtype=np.float32):
278
247
  """
279
248
  Generates synthetic examples to balance classes with fewer examples.
280
249
 
@@ -288,24 +257,12 @@ def synthetic_augmentation(x_train, y_train, dtype=np.float32):
288
257
  y_balanced -- Balanced class labels (one-hot encoded, array format)
289
258
  """
290
259
  from .ui import loading_bars
291
-
292
- bar_format = loading_bars()[0]
260
+ from .memory_operations import transfer_to_cpu
293
261
 
294
- x_train = x_train.astype(dtype)
295
- if len(y_train[0]) < 256:
296
- if y_train.dtype != np.uint8:
297
- y_train = np.array(y_train, copy=False).astype(np.uint8, copy=False)
298
- elif len(y_train[0]) <= 32767:
299
- if y_train.dtype != np.uint16:
300
- y_train = np.array(y_train, copy=False).astype(np.uint16, copy=False)
301
- else:
302
- if y_train.dtype != np.uint32:
303
- y_train = np.array(y_train, copy=False).astype(np.uint32, copy=False)
304
-
305
- x = x_train
306
- y = y_train
262
+ x = transfer_to_cpu(x, dtype=dtype)
307
263
 
308
- classes = np.arange(y_train.shape[1])
264
+ bar_format = loading_bars()[0]
265
+ classes = np.arange(y.shape[1])
309
266
  class_count = len(classes)
310
267
 
311
268
  class_distribution = {i: 0 for i in range(class_count)}
@@ -340,8 +297,12 @@ def synthetic_augmentation(x_train, y_train, dtype=np.float32):
340
297
 
341
298
  num_samples += 1
342
299
 
300
+ x_balanced = np.array(x_balanced).astype(dtype, copy=False)
301
+ y_balanced = np.array(y_balanced).astype(dtype=y.dtype, copy=False)
302
+
303
+ del x, y
343
304
 
344
- return np.array(x_balanced).astype(dtype, copy=False), np.array(y_balanced).astype(dtype, copy=False)
305
+ return x_balanced, y_balanced
345
306
 
346
307
 
347
308
  def standard_scaler(x_train=None, x_test=None, scaler_params=None, dtype=np.float32):