pyerualjetwork 4.0.0__py3-none-any.whl → 4.0.2__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.
@@ -56,8 +56,8 @@ days, seconds = divmod(remaining_time.total_seconds(), 86400)
56
56
  hours, seconds = divmod(seconds, 3600)
57
57
  minutes, seconds = divmod(seconds, 60)
58
58
 
59
- __version__ = "4.0.0"
60
- __update__ = f"\033[33m --- IMPORTANT NOTE! --- \n pyerualjetwork==4.0.0 inludes anaplan==2.6.1. Name changed. Full support starting January 10, 2025. TIME REMAINING TO FULL SUPPORT: {int(days)} days, {int(hours):02} hours, {int(minutes):02} minutes, {int(seconds):02} seconds\033[0m\n* Changes: https://github.com/HCB06/Anaplan/blob/main/CHANGES\n* Anaplan document: https://github.com/HCB06/Anaplan/blob/main/Anaplan/ANAPLAN_USER_MANUEL_AND_LEGAL_INFORMATION(EN).pdf.\n* YouTube tutorials: https://www.youtube.com/@HasanCanBeydili"
59
+ __version__ = "4.0.2"
60
+ __update__ = f"\033[33m --- IMPORTANT NOTE! --- \n 'anaplan' name changed to 'pyerualjetwork'. Full 'pyerualjetwork' support starting January 10, 2025. TIME REMAINING TO END OF SUPPORT ANAPLAN: {int(days)} days, {int(hours):02} hours, {int(minutes):02} minutes, {int(seconds):02} seconds\033[0m\n* Changes: https://github.com/HCB06/Anaplan/blob/main/CHANGES\n* PyerualJetwork document: https://github.com/HCB06/Anaplan/blob/main/PyerualJetwork/PYERUALJETWORK_USER_MANUEL_AND_LEGAL_INFORMATION(EN).pdf.\n* YouTube tutorials: https://www.youtube.com/@HasanCanBeydili"
61
61
 
62
62
  def print_version(__version__):
63
63
  print(f"PyerualJetwork Version {__version__}" + '\n')
@@ -239,10 +239,12 @@ def load_model(model_name,
239
239
  return W, None, None, activation_potentiation, scaler_params
240
240
 
241
241
 
242
- def predict_model_ssd(Input, model_name, model_path):
242
+
243
+ def predict_model_ssd(Input, model_name, model_path=''):
243
244
 
244
245
  """
245
- Function to make a prediction using a divided potentiation learning artificial neural network (PLAN).
246
+ Function to make a prediction using a potentiation learning artificial neural network (PLAN).
247
+ from storage
246
248
 
247
249
  Arguments:
248
250
 
@@ -250,6 +252,8 @@ def predict_model_ssd(Input, model_name, model_path):
250
252
 
251
253
  model_name (str): Name of the model.
252
254
 
255
+ model_path (str): Path of the model. Default: ''
256
+
253
257
  Returns:
254
258
  ndarray: Output from the model.
255
259
  """
@@ -265,24 +269,52 @@ def predict_model_ssd(Input, model_name, model_path):
265
269
 
266
270
  Input = standard_scaler(None, Input, scaler_params)
267
271
 
268
- Wc = np.copy(W)
269
-
270
272
  neural_layer = Input
271
273
  neural_layer = np.array(neural_layer)
272
274
  neural_layer = neural_layer.ravel()
273
275
 
276
+ try:
277
+ neural_layer = feed_forward(neural_layer, np.copy(W), is_training=False, Class='?', activation_potentiation=activation_potentiation)
278
+ return neural_layer
279
+ except:
280
+ print(Fore.RED + "ERROR: Unexpected Output or wrong model parameters from: predict_model_ssd." + Style.RESET_ALL)
281
+ sys.exit()
274
282
 
275
- neural_layer = feed_forward(neural_layer, W, is_training=False, Class='?', activation_potentiation=activation_potentiation)
276
283
 
277
- W = np.copy(Wc)
278
- return neural_layer
284
+ def reverse_predict_model_ssd(output, model_name, model_path=''):
285
+
286
+ """
287
+ reverse prediction function from storage
288
+ Arguments:
289
+
290
+ output (list or ndarray): output layer for the model (single probability vector, output layer of trained model).
291
+
292
+ model_name (str): Name of the model.
293
+
294
+ model_path (str): Path of the model. Default: ''
295
+
296
+ Returns:
297
+ ndarray: Input from the model.
298
+ """
299
+
300
+ model = load_model(model_name, model_path)
301
+
302
+ W = model[get_weights()]
303
+
304
+ try:
305
+ Input = np.dot(output, np.copy(W))
306
+ return Input
307
+ except:
308
+ print(Fore.RED + "ERROR: Unexpected Output or wrong model parameters from: reverse_predict_model_ssd." + Style.RESET_ALL)
309
+ sys.exit()
310
+
279
311
 
280
312
 
281
313
  def predict_model_ram(Input, W, scaler_params=None, activation_potentiation=['linear']):
282
314
 
283
315
  """
284
- Function to make a prediction using a divided potentiation learning artificial neural network (PLAN).
285
- from weights and parameters stored in memory.
316
+ Function to make a prediction using a potentiation learning artificial neural network (PLAN).
317
+ from memory.
286
318
 
287
319
  Arguments:
288
320
 
@@ -302,8 +334,6 @@ def predict_model_ram(Input, W, scaler_params=None, activation_potentiation=['li
302
334
  from .plan import feed_forward
303
335
 
304
336
  Input = standard_scaler(None, Input, scaler_params)
305
-
306
- Wc = np.copy(W)
307
337
 
308
338
  try:
309
339
 
@@ -311,15 +341,37 @@ def predict_model_ram(Input, W, scaler_params=None, activation_potentiation=['li
311
341
  neural_layer = np.array(neural_layer)
312
342
  neural_layer = neural_layer.ravel()
313
343
 
314
- neural_layer = feed_forward(neural_layer, W, is_training=False, Class='?', activation_potentiation=activation_potentiation)
344
+ neural_layer = feed_forward(neural_layer, np.copy(W), is_training=False, Class='?', activation_potentiation=activation_potentiation)
315
345
 
316
- W = np.copy(Wc)
317
346
  return neural_layer
318
347
 
319
348
  except:
320
349
  print(Fore.RED + "ERROR: Unexpected input or wrong model parameters from: predict_model_ram." + Style.RESET_ALL)
321
350
  sys.exit()
322
351
 
352
+ def reverse_predict_model_ram(output, W):
353
+
354
+ """
355
+ reverse prediction function from memory
356
+
357
+ Arguments:
358
+
359
+ output (list or ndarray): output layer for the model (single probability vector, output layer of trained model).
360
+
361
+ W (list of ndarrays): Weights of the model.
362
+
363
+ Returns:
364
+ ndarray: Input from the model.
365
+ """
366
+
367
+ try:
368
+ Input = np.dot(output, np.copy(W))
369
+ return Input
370
+
371
+ except:
372
+ print(Fore.RED + "ERROR: Unexpected Output or wrong model parameters from: reverse_predict_model_ram." + Style.RESET_ALL)
373
+ sys.exit()
374
+
323
375
 
324
376
  def get_weights():
325
377
 
pyerualjetwork/plan.py CHANGED
@@ -47,7 +47,7 @@ bar_format_learner = loading_bars()[1]
47
47
  def fit(
48
48
  x_train,
49
49
  y_train,
50
- val=None,
50
+ val=False,
51
51
  val_count=None,
52
52
  activation_potentiation=['linear'],
53
53
  x_val=None,
@@ -580,14 +580,11 @@ def evaluate(
580
580
 
581
581
  try:
582
582
 
583
- Wc = [0] * len(W) # Wc = Weight copy
584
583
  true_predict = 0
585
584
  y_preds = []
586
585
  y_preds_raw = []
587
586
  acc_list = []
588
587
 
589
- Wc = np.copy(W)
590
-
591
588
 
592
589
  if loading_bar_status == True:
593
590
 
@@ -600,10 +597,6 @@ def evaluate(
600
597
 
601
598
 
602
599
  neural_layer = feed_forward(neural_layer, W, is_training=False, Class='?', activation_potentiation=activation_potentiation)
603
-
604
-
605
- W = np.copy(Wc)
606
-
607
600
  neural_layer = Softmax(neural_layer)
608
601
 
609
602
  max_value = max(neural_layer)
@@ -633,13 +626,10 @@ def evaluate(
633
626
  if show_metrics == True:
634
627
 
635
628
  loading_bar.close()
636
- plot_evaluate(x_test, y_test, y_preds, acc_list, W=W, activation_potentiation=activation_potentiation)
637
-
638
- W = np.copy(Wc)
629
+ plot_evaluate(x_test, y_test, y_preds, acc_list, W=np.copy(W), activation_potentiation=activation_potentiation)
639
630
 
640
631
  except Exception as e:
641
632
 
642
- print(Fore.RED + 'ERROR:' + str(e) + Style.RESET_ALL)
643
- sys.exit()
633
+ raise(e)
644
634
 
645
635
  return W, y_preds, acc, None, None, y_preds_raw
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyerualjetwork
3
- Version: 4.0.0
3
+ Version: 4.0.2
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
@@ -1,15 +1,15 @@
1
- pyerualjetwork/__init__.py,sha256=vTHUnMi8HRbKs_rQEDajOTcQiDqtaUVcj2g3y3YKAO8,2846
1
+ pyerualjetwork/__init__.py,sha256=zatdprNpjP2p7jJdGJ4dwYgvgnO8h0CS6asMmuOY66Y,2878
2
2
  pyerualjetwork/activation_functions.py,sha256=iJpdsX8FqZ3lB3x-YG7d9-em8xHD0y1ciJLNWmI7Y6A,9941
3
3
  pyerualjetwork/data_operations.py,sha256=mph66_qGQHxhg_gQtTuOzP2PjTwJsxTGzmRmvrzlQn4,12747
4
4
  pyerualjetwork/help.py,sha256=5Du_Cja5iPvGeVS9dAoehKTJmRgb_7c6Qsn7Cy2ZfTs,823
5
5
  pyerualjetwork/loss_functions.py,sha256=6PyBI232SQRGuFnG3LDGvnv_PUdWzT2_2mUODJiejGI,618
6
6
  pyerualjetwork/metrics.py,sha256=q7MkhnZDRbCjFBDDfUgrl8lBYnUT_1ro1LxeBq105pI,6077
7
- pyerualjetwork/model_operations.py,sha256=f_k_wdPAYXVmzH01kQ2UTbcYO89DaU6_8UbK-XSX-z8,10492
8
- pyerualjetwork/plan.py,sha256=R8e8-S5F9eQOb9YZA6VQ9BCu94gJXMfn_nKkl4ZNpQE,31848
7
+ pyerualjetwork/model_operations.py,sha256=eXFUVZUO6vf_uO4auevWzne1RYSvD6Efz_IdH77DGZc,11980
8
+ pyerualjetwork/plan.py,sha256=PfsSNFe1qY_MIF1MoM_pbP-1s_HrADSLUsW9AI15nIk,31621
9
9
  pyerualjetwork/planeat.py,sha256=3l4c-sMqTY6mQvW9u2OarcccUYcMxqASQXgx1GjNZSA,38061
10
10
  pyerualjetwork/ui.py,sha256=wu2BhU1k-w3Kcho5Jtq4SEKe68ftaUeRGneUOSCVDjU,575
11
11
  pyerualjetwork/visualizations.py,sha256=DvbiQGlvlKNAgBJ3O3ukAi6uxSheha9SRFh5YX7ZxIA,26678
12
- pyerualjetwork-4.0.0.dist-info/METADATA,sha256=5JzOCtHCqNLV5_TT9Pp8Ld1fZYT-Qys0vIfYWNXq1n8,6430
13
- pyerualjetwork-4.0.0.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
14
- pyerualjetwork-4.0.0.dist-info/top_level.txt,sha256=BRyt62U_r3ZmJpj-wXNOoA345Bzamrj6RbaWsyW4tRg,15
15
- pyerualjetwork-4.0.0.dist-info/RECORD,,
12
+ pyerualjetwork-4.0.2.dist-info/METADATA,sha256=at2jKFwd4HUob3xaVeci1h7hLSW_xNbwsSS4-l1z5io,6430
13
+ pyerualjetwork-4.0.2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
14
+ pyerualjetwork-4.0.2.dist-info/top_level.txt,sha256=BRyt62U_r3ZmJpj-wXNOoA345Bzamrj6RbaWsyW4tRg,15
15
+ pyerualjetwork-4.0.2.dist-info/RECORD,,