pyerualjetwork 2.4.3__py3-none-any.whl → 2.4.5__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.
plan_bi/plan_bi.py CHANGED
@@ -90,16 +90,22 @@ def fit(
90
90
 
91
91
  if show_training == True:
92
92
 
93
- fig, ax = plt.subplots(1, 10, figsize=(18, 14))
93
+ fig, ax = plt.subplots(1, len(class_count), figsize=(18, 14))
94
94
 
95
95
  try:
96
96
  row = x_train[1].shape[0]
97
97
  col = x_train[1].shape[1]
98
98
  except:
99
+
99
100
  print(Fore.MAGENTA + 'WARNING: You try train showing but inputs is raveled. x_train inputs to should be reshape for training_show.', infoPLAN + Style.RESET_ALL)
100
101
 
101
- row, col = find_factors(len(x_train[0]))
102
-
102
+ try:
103
+ row, col = find_numbers(len(x_train[0]))
104
+
105
+ except:
106
+ print(Fore.RED + 'ERROR: You try train showing but inputs is raveled. x_train inputs to must be reshape for training_show. Input length cannot be reshaped', infoPLAN + Style.RESET_ALL)
107
+ return 'e'
108
+
103
109
  for j in range(len(class_count)):
104
110
 
105
111
  mat = trained_W[0][j,:].reshape(row, col)
@@ -112,7 +118,7 @@ def fit(
112
118
  ax[j].set_title(f'{j+1}. Neuron')
113
119
 
114
120
 
115
- plt.show()
121
+ plt.show()
116
122
 
117
123
 
118
124
  W = weight_identification(len(layers) - 1, len(class_count), neurons, x_train_size)
@@ -136,15 +142,22 @@ def fit(
136
142
 
137
143
  if show_training == 'final':
138
144
 
139
- fig, ax = plt.subplots(1, 10, figsize=(18, 14))
145
+ fig, ax = plt.subplots(1, len(class_count), figsize=(18, 14))
140
146
 
141
147
  try:
142
148
  row = x_train[1].shape[0]
143
149
  col = x_train[1].shape[1]
144
150
  except:
151
+
145
152
  print(Fore.MAGENTA + 'WARNING: You try train showing but inputs is raveled. x_train inputs to should be reshape for training_show.', infoPLAN + Style.RESET_ALL)
146
153
 
147
- row, col = find_factors(len(x_train[0]))
154
+ try:
155
+ row, col = find_numbers(len(x_train[0]))
156
+
157
+ except:
158
+
159
+ print(Fore.RED + 'ERROR: You try train showing but inputs is raveled. x_train inputs to must be reshape for training_show. Input length cannot be reshaped', infoPLAN + Style.RESET_ALL)
160
+ return 'e'
148
161
 
149
162
  for j in range(len(class_count)):
150
163
 
@@ -158,7 +171,7 @@ def fit(
158
171
  ax[j].set_title(f'{j+1}. Neuron')
159
172
 
160
173
 
161
- plt.show()
174
+ plt.show()
162
175
 
163
176
  EndTime = time.time()
164
177
 
@@ -204,31 +217,18 @@ def weight_normalization(
204
217
 
205
218
  # FUNCTIONS -----
206
219
 
207
- def prime_factors(n):
208
- factors = []
209
- divisor = 2
210
-
211
- while divisor <= n:
212
- if n % divisor == 0:
213
- factors.append(divisor)
214
- n //= divisor
215
- else:
216
- divisor += 1
217
-
218
- return factors
220
+ def find_numbers(n):
221
+ if n <= 1:
222
+ raise ValueError("Parameter 'n' must be greater than 1.")
219
223
 
220
- def find_factors(n):
221
- factors = prime_factors(n)
222
-
223
- if len(factors) < 2:
224
- return None, None
225
-
226
- a = factors[0]
227
- b = 1
228
- for factor in factors[1:]:
229
- b *= factor
230
-
231
- return a, b
224
+ for i in range(2, int(n**0.5) + 1):
225
+ if n % i == 0:
226
+ factor1 = i
227
+ factor2 = n // i
228
+ if factor1 == factor2:
229
+ return factor1, factor2
230
+
231
+ return None
232
232
 
233
233
  def weight_identification(
234
234
  layer_count, # int: Number of layers in the neural network.
plan_di/plan_di.py CHANGED
@@ -90,15 +90,24 @@ def fit(
90
90
 
91
91
  if show_training == True:
92
92
 
93
- fig, ax = plt.subplots(1, 10, figsize=(18, 14))
93
+ fig, ax = plt.subplots(1, len(class_count), figsize=(18, 14))
94
94
 
95
95
  try:
96
96
  row = x_train[1].shape[0]
97
97
  col = x_train[1].shape[1]
98
+
98
99
  except:
100
+
99
101
  print(Fore.MAGENTA + 'WARNING: You try train showing but inputs is raveled. x_train inputs to should be reshape for training_show.', infoPLAN + Style.RESET_ALL)
100
102
 
101
- row, col = find_factors(len(x_train[0]))
103
+ try:
104
+ row, col = find_numbers(len(x_train[0]))
105
+
106
+ except:
107
+
108
+ print(Fore.RED + 'ERROR: You try train showing but inputs is raveled. x_train inputs to must be reshape for training_show. Input length cannot be reshaped', infoPLAN + Style.RESET_ALL)
109
+ return 'e'
110
+
102
111
 
103
112
  for j in range(len(class_count)):
104
113
 
@@ -112,7 +121,7 @@ def fit(
112
121
  ax[j].set_title(f'{j+1}. Neuron')
113
122
 
114
123
 
115
- plt.show()
124
+ plt.show()
116
125
 
117
126
  W = weight_identification(
118
127
  len(layers) - 1, len(class_count), neurons, x_train_size)
@@ -135,15 +144,23 @@ def fit(
135
144
 
136
145
  if show_training == 'final':
137
146
 
138
- fig, ax = plt.subplots(1, 10, figsize=(18, 14))
147
+ fig, ax = plt.subplots(1, len(class_count), figsize=(18, 14))
139
148
 
140
149
  try:
150
+
141
151
  row = x_train[1].shape[0]
142
152
  col = x_train[1].shape[1]
153
+
143
154
  except:
155
+
144
156
  print(Fore.MAGENTA + 'WARNING: You try train showing but inputs is raveled. x_train inputs to should be reshape for training_show.', infoPLAN + Style.RESET_ALL)
145
157
 
146
- row, col = find_factors(len(x_train[0]))
158
+ try:
159
+ row, col = find_numbers(len(x_train[0]))
160
+
161
+ except:
162
+ print(Fore.RED + 'ERROR: You try train showing but inputs is raveled. x_train inputs to must be reshape for training_show. Input length cannot be reshaped', infoPLAN + Style.RESET_ALL)
163
+ return 'e'
147
164
 
148
165
  for j in range(len(class_count)):
149
166
 
@@ -157,7 +174,7 @@ def fit(
157
174
  ax[j].set_title(f'{j+1}. Neuron')
158
175
 
159
176
 
160
- plt.show()
177
+ plt.show()
161
178
 
162
179
  EndTime = time.time()
163
180
 
@@ -182,31 +199,18 @@ def fit(
182
199
 
183
200
  # FUNCTIONS -----
184
201
 
185
- def prime_factors(n):
186
- factors = []
187
- divisor = 2
188
-
189
- while divisor <= n:
190
- if n % divisor == 0:
191
- factors.append(divisor)
192
- n //= divisor
193
- else:
194
- divisor += 1
195
-
196
- return factors
202
+ def find_numbers(n):
203
+ if n <= 1:
204
+ raise ValueError("Parameter 'n' must be greater than 1.")
197
205
 
198
- def find_factors(n):
199
- factors = prime_factors(n)
200
-
201
- if len(factors) < 2:
202
- return None, None
203
-
204
- a = factors[0]
205
- b = 1
206
- for factor in factors[1:]:
207
- b *= factor
208
-
209
- return a, b
206
+ for i in range(2, int(n**0.5) + 1):
207
+ if n % i == 0:
208
+ factor1 = i
209
+ factor2 = n // i
210
+ if factor1 == factor2:
211
+ return factor1, factor2
212
+
213
+ return None
210
214
 
211
215
  def weight_normalization(
212
216
  W,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyerualjetwork
3
- Version: 2.4.3
3
+ Version: 2.4.5
4
4
  Summary: show_training parameter added for fit function[True, 'final' or any]. Code improvements
5
5
  Author: Hasan Can Beydili
6
6
  Author-email: tchasancan@gmail.com
@@ -0,0 +1,8 @@
1
+ plan_bi/__init__.py,sha256=kHnuGDOKyMHQqeX49ToUUsdZckh9RPuyADhYw0SrmIo,514
2
+ plan_bi/plan_bi.py,sha256=OyoD1JmD68Ad-t4VMHjAtiCqMrgiIg9vHpk49yyuG0w,53624
3
+ plan_di/__init__.py,sha256=DJzUsYj-tgbeewoGz-K9nfGsKqrRFUxIr_z-NgqySBk,505
4
+ plan_di/plan_di.py,sha256=MGEDr4fVeGKyzcpricjXY_OYRiJ8duKEYlFKSwUS77I,51166
5
+ pyerualjetwork-2.4.5.dist-info/METADATA,sha256=2ADPscK7U5r4xlhJW3GTNJkecbE1kh2imZdDivVlD0s,309
6
+ pyerualjetwork-2.4.5.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
7
+ pyerualjetwork-2.4.5.dist-info/top_level.txt,sha256=aaXSOcnD62fbXG1x7tw4nV50Qxx9g9zDNLK7OD4BdPE,16
8
+ pyerualjetwork-2.4.5.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- plan_bi/__init__.py,sha256=kHnuGDOKyMHQqeX49ToUUsdZckh9RPuyADhYw0SrmIo,514
2
- plan_bi/plan_bi.py,sha256=GJilBGENKFA1S_3QBAoFS5IaDu1UHGgiC1VPJmY4wGc,53069
3
- plan_di/__init__.py,sha256=DJzUsYj-tgbeewoGz-K9nfGsKqrRFUxIr_z-NgqySBk,505
4
- plan_di/plan_di.py,sha256=izbP2BuixM2bUumACPXYE66Wj6LnVbuiH3NXLMrN2EY,50514
5
- pyerualjetwork-2.4.3.dist-info/METADATA,sha256=ZoBtjCTB1E_6NRXZXY4d8u5VZve_jmyrtzHiirG8J1w,309
6
- pyerualjetwork-2.4.3.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
7
- pyerualjetwork-2.4.3.dist-info/top_level.txt,sha256=aaXSOcnD62fbXG1x7tw4nV50Qxx9g9zDNLK7OD4BdPE,16
8
- pyerualjetwork-2.4.3.dist-info/RECORD,,