pyerualjetwork 2.5.6__tar.gz → 2.5.8__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyerualjetwork
3
- Version: 2.5.6
3
+ Version: 2.5.8
4
4
  Summary: New optional parameters added for fit function, x_val, y_val show_count, val_count, val. For more information please read user document
5
5
  Author: Hasan Can Beydili
6
6
  Author-email: tchasancan@gmail.com
@@ -1,3 +1,11 @@
1
+
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ Created on Tue Jun 18 23:32:16 2024
5
+
6
+ @author: hasan
7
+ """
8
+
1
9
  # optic
2
10
 
3
11
  # -*- coding: utf-8 -*-
@@ -50,7 +58,7 @@ def fit(
50
58
  y_train (list[num]): List of target labels. (one hot encoded)
51
59
  show_training (bool, str): True, None or'final'
52
60
  show_count (None, int): How many learning steps in total will be displayed in a single figure? (Adjust according to your hardware) Default: 10 (optional)
53
- val_count (None, int): After how many examples learned will an accuracy test be performed? Default: 100 (optional)
61
+ val_count (None, int): After how many examples learned will an accuracy test be performed? Default: 0.1 (%10) (optional)
54
62
  x_val (list[num]): List of validation data. (optional) Default: x_train
55
63
  y_val (list[num]): (list[num]): List of target labels. (one hot encoded) (optional) Default: y_train
56
64
  activation_potential (float): Input activation potential (for binary injection) (optional) in range: -1, 1
@@ -72,8 +80,14 @@ def fit(
72
80
 
73
81
  if val == True and val_count == None:
74
82
 
75
- val_count = 100
76
-
83
+ val_count = 0.1
84
+ val_count_copy = val_count
85
+
86
+ if val == True:
87
+
88
+ val_count = int(len(x_train) * val_count)
89
+
90
+ val_count_copy = val_count
77
91
 
78
92
  if show_training == True or show_training == 'final' and show_count == None:
79
93
 
@@ -82,10 +96,6 @@ def fit(
82
96
  if show_training == True or show_training == 'final':
83
97
 
84
98
  row, col = shape_control(x_train)
85
-
86
- if row == 0:
87
-
88
- return 'e'
89
99
 
90
100
  class_count = set()
91
101
 
@@ -141,7 +151,9 @@ def fit(
141
151
 
142
152
  if val == True:
143
153
 
144
- if index %val_count == 0:
154
+ if index == val_count:
155
+
156
+ val_count += val_count_copy
145
157
 
146
158
  layers.append('cat')
147
159
  trained_W.append(np.eye(len(class_count)))
@@ -170,32 +182,54 @@ def fit(
170
182
  if show_training == True:
171
183
 
172
184
  if index %show_count == 0:
173
-
174
- if index != 0:
185
+
186
+
187
+ if index != 0:
175
188
  plt.close(fig)
176
189
 
177
- fig, ax = plt.subplots(1, len(class_count), figsize=(18, 14))
190
+ if row != 0:
191
+
192
+ fig, ax = plt.subplots(1, len(class_count), figsize=(18, 14))
178
193
 
194
+ else:
195
+
196
+ fig, ax = plt.subplots(1, 1, figsize=(18, 14))
179
197
 
180
198
  for j in range(len(class_count)):
181
-
182
- mat = trained_W[0][j,:].reshape(row, col)
183
199
 
184
- ax[j].imshow(mat, interpolation='sinc', cmap='viridis')
185
- ax[j].set_aspect('equal')
186
-
187
- ax[j].set_xticks([])
188
- ax[j].set_yticks([])
189
- ax[j].set_title(f'{j+1}. Neuron')
190
-
191
- progress_status = f"{progress:.1f}"
192
- fig.suptitle('Neurons Learning Progress: % ' + progress_status)
193
- plt.draw()
194
- plt.pause(0.1)
200
+
201
+ if row != 0:
202
+
203
+ mat = trained_W[0][j,:].reshape(row, col)
204
+ suptitle_info = 'Neurons Learning Progress: % '
205
+ title_info = f'{j+1}. Neuron'
206
+
207
+ mat = trained_W[0][j,:].reshape(row, col)
195
208
 
209
+ ax[j].imshow(mat, interpolation='sinc', cmap='viridis')
196
210
 
211
+ ax[j].set_aspect('equal')
212
+
213
+ ax[j].set_xticks([])
214
+ ax[j].set_yticks([])
215
+ ax[j].set_title(title_info)
197
216
 
217
+ else:
218
+
219
+ mat = trained_W[0]
220
+ ax.imshow(mat, interpolation='sinc', cmap='viridis')
221
+ suptitle_info = 'Weight Learning Progress: % '
222
+ title_info = 'Weight Matrix Of Fex Layer'
223
+
224
+
225
+
198
226
 
227
+ progress_status = f"{progress:.1f}"
228
+ fig.suptitle(suptitle_info + progress_status)
229
+ plt.draw()
230
+ plt.pause(0.1)
231
+
232
+
199
233
  W = weight_identification(
200
234
  len(layers) - 1, len(class_count), neurons, x_train_size)
201
235
 
@@ -274,7 +308,7 @@ def shape_control(x_train):
274
308
 
275
309
  except:
276
310
 
277
- print(Fore.RED + 'ERROR: Change show_training to None. Input length cannot be reshaped', infoPLAN + Style.RESET_ALL)
311
+ print(Fore.MAGENTA + 'WARNING: Input length cannot be reshaped. Neurons learning progression cannot be draw, weight learning progress drwaing started.' + Style.RESET_ALL)
278
312
  return [0, 0]
279
313
 
280
314
  return row, col
@@ -1661,4 +1695,4 @@ def get_preds():
1661
1695
 
1662
1696
  def get_acc():
1663
1697
 
1664
- return 2
1698
+ return 2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyerualjetwork
3
- Version: 2.5.6
3
+ Version: 2.5.8
4
4
  Summary: New optional parameters added for fit function, x_val, y_val show_count, val_count, val. For more information please read user document
5
5
  Author: Hasan Can Beydili
6
6
  Author-email: tchasancan@gmail.com
@@ -5,7 +5,7 @@ from setuptools import setup, find_packages
5
5
  setup(
6
6
 
7
7
  name = "pyerualjetwork",
8
- version = "2.5.6",
8
+ version = "2.5.8",
9
9
  author = "Hasan Can Beydili",
10
10
  author_email = "tchasancan@gmail.com",
11
11
  description= "New optional parameters added for fit function, x_val, y_val show_count, val_count, val. For more information please read user document",
File without changes