pyerualjetwork 4.2.9b6__py3-none-any.whl → 4.3.0__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.
@@ -1,4 +1,4 @@
1
- __version__ = "4.2.9b6"
1
+ __version__ = "4.3.0"
2
2
  __update__ = "* Changes: https://github.com/HCB06/PyerualJetwork/blob/main/CHANGES\n* PyerualJetwork Homepage: https://github.com/HCB06/PyerualJetwork/tree/main\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"
3
3
 
4
4
  def print_version(__version__):
@@ -218,12 +218,14 @@ def scaled_cubic(x, alpha=1.0):
218
218
  def sine_offset(x, beta=0.0):
219
219
  return np.sin(x + beta)
220
220
 
221
+
221
222
  def safe_add(current_sum, new_value):
222
223
  try:
223
224
  return current_sum + new_value
224
225
  except OverflowError:
225
226
  return np.array(current_sum) + np.array(new_value)
226
227
 
228
+
227
229
  def apply_activation(Input, activation_list):
228
230
  """
229
231
  Applies a sequence of activation functions to the input.
@@ -218,7 +218,6 @@ def sine_offset(x, beta=0.0):
218
218
  return cp.sin(x + beta)
219
219
 
220
220
 
221
-
222
221
  def safe_add(current_sum, new_value):
223
222
  try:
224
223
  return current_sum + new_value
@@ -230,11 +229,11 @@ def apply_activation(Input, activation_list):
230
229
  Applies a sequence of activation functions to the input.
231
230
 
232
231
  Args:
233
- Input (numpy.ndarray): The input to apply activations to.
232
+ Input (cupy.ndarray): The input to apply activations to.
234
233
  activation_list (list): A list of activation function names to apply.
235
234
 
236
235
  Returns:
237
- numpy.ndarray: The input after all activations have been applied.
236
+ cupy.ndarray: The input after all activations have been applied.
238
237
  """
239
238
 
240
239
  origin_input = cp.copy(Input)
@@ -55,9 +55,8 @@ def decode_one_hot(encoded_data):
55
55
  numpy.ndarray: Decoded categorical labels with shape (n_samples,).
56
56
  """
57
57
 
58
- decoded_labels = np.argmax(encoded_data, axis=1)
59
-
60
- return decoded_labels
58
+ if encoded_data.ndim == 1: return np.argmax(encoded_data)
59
+ else: return np.argmax(encoded_data, axis=1)
61
60
 
62
61
 
63
62
  def split(X, y, test_size, random_state=42, dtype=np.float32):
pyerualjetwork/plan.py CHANGED
@@ -135,9 +135,9 @@ def fit(
135
135
  # Training process
136
136
  for index, inp in enumerate(x_train):
137
137
  inp = np.array(inp, copy=False).ravel()
138
- y_decoded = decode_one_hot(y_train)
138
+ y_decoded = decode_one_hot(y_train[index])
139
139
  # Weight updates
140
- STPW = feed_forward(inp, STPW, is_training=True, Class=y_decoded[index], activation_potentiation=activation_potentiation, LTD=LTD)
140
+ STPW = feed_forward(inp, STPW, is_training=True, Class=y_decoded, activation_potentiation=activation_potentiation, LTD=LTD)
141
141
  LTPW += normalization(STPW, dtype=dtype) if auto_normalization else STPW
142
142
  if val and index != 0:
143
143
  if index % math.ceil((val_count / len(x_train)) * 100) == 0:
@@ -349,8 +349,8 @@ def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=Non
349
349
  (strategy == 'recall' and recall_score >= best_recall)):
350
350
 
351
351
  best_acc = acc
352
- best_weights = weight_pop[j]
353
- final_activations = act_pop[j]
352
+ best_weights = np.copy(weight_pop[j])
353
+ final_activations = act_pop[j].copy() if isinstance(act_pop[j], list) else act_pop[j]
354
354
  best_model = model
355
355
 
356
356
  final_activations = [final_activations[0]] if len(set(final_activations)) == 1 else final_activations # removing if all same
@@ -412,8 +412,8 @@ def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=Non
412
412
  y_pred_batch=train_model[get_preds_softmax()])
413
413
 
414
414
  print('\nActivations: ', final_activations)
415
- print(f'Train Accuracy (%{batch_size * 100} of train samples):', train_model[get_acc()])
416
- print(f'Train Loss (%{batch_size * 100} of train samples): ', train_loss, '\n')
415
+ print(f'Train Accuracy :', train_model[get_acc()])
416
+ print(f'Train Loss : ', train_loss, '\n')
417
417
 
418
418
  # Display final visualizations
419
419
  display_visualizations_for_learner(viz_objects, best_weights, data, best_acc,
@@ -434,8 +434,8 @@ def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=Non
434
434
  y_pred_batch=train_model[get_preds_softmax()])
435
435
 
436
436
  print('\nActivations: ', final_activations)
437
- print(f'Train Accuracy (%{batch_size * 100} of train samples):', train_model[get_acc()])
438
- print(f'Train Loss (%{batch_size * 100} of train samples): ', train_loss, '\n')
437
+ print(f'Train Accuracy :', train_model[get_acc()])
438
+ print(f'Train Loss : ', train_loss, '\n')
439
439
 
440
440
  # Display final visualizations
441
441
  display_visualizations_for_learner(viz_objects, best_weights, data, best_acc,
@@ -465,8 +465,8 @@ def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=Non
465
465
  y_pred_batch=train_model[get_preds_softmax()])
466
466
 
467
467
  print('\nActivations: ', final_activations)
468
- print(f'Train Accuracy (%{batch_size * 100} of train samples):', train_model[get_acc()])
469
- print(f'Train Loss (%{batch_size * 100} of train samples): ', train_loss, '\n')
468
+ print(f'Train Accuracy :', train_model[get_acc()])
469
+ print(f'Train Loss : ', train_loss, '\n')
470
470
 
471
471
  # Display final visualizations
472
472
  display_visualizations_for_learner(viz_objects, best_weights, data, best_acc,
@@ -484,8 +484,8 @@ def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=Non
484
484
  train_loss = binary_crossentropy(y_true_batch=y_train, y_pred_batch=train_model[get_preds_softmax()])
485
485
 
486
486
  print('\nActivations: ', final_activations)
487
- print(f'Train Accuracy (%{batch_size * 100} of train samples):', train_model[get_acc()])
488
- print(f'Train Loss (%{batch_size * 100} of train samples): ', train_loss, '\n')
487
+ print(f'Train Accuracy :', train_model[get_acc()])
488
+ print(f'Train Loss : ', train_loss, '\n')
489
489
 
490
490
  # Display final visualizations
491
491
  display_visualizations_for_learner(viz_objects, best_weights, data, best_acc, train_loss, y_train, interval)
@@ -374,8 +374,8 @@ def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=Non
374
374
  (strategy == 'recall' and recall_score >= best_recall)):
375
375
 
376
376
  best_acc = acc
377
- best_weights = weight_pop[j]
378
- final_activations = act_pop[j]
377
+ best_weights = cp.copy(weight_pop[j])
378
+ final_activations = act_pop[j].copy() if isinstance(act_pop[j], list) else act_pop[j]
379
379
  best_model = model
380
380
 
381
381
  final_activations = [final_activations[0]] if len(set(final_activations)) == 1 else final_activations # removing if all same
@@ -437,8 +437,8 @@ def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=Non
437
437
  y_pred_batch=train_model[get_preds_softmax()])
438
438
 
439
439
  print('\nActivations: ', final_activations)
440
- print(f'Train Accuracy (%{batch_size * 100} of train samples):', train_model[get_acc()])
441
- print(f'Train Loss (%{batch_size * 100} of train samples): ', train_loss, '\n')
440
+ print(f'Train Accuracy:', train_model[get_acc()])
441
+ print(f'Train Loss: ', train_loss, '\n')
442
442
 
443
443
  # Display final visualizations
444
444
  display_visualizations_for_learner(viz_objects, best_weights, data, best_acc,
@@ -459,8 +459,8 @@ def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=Non
459
459
  y_pred_batch=train_model[get_preds_softmax()])
460
460
 
461
461
  print('\nActivations: ', final_activations)
462
- print(f'Train Accuracy (%{batch_size * 100} of train samples):', train_model[get_acc()])
463
- print(f'Train Loss (%{batch_size * 100} of train samples): ', train_loss, '\n')
462
+ print(f'Train Accuracy:', train_model[get_acc()])
463
+ print(f'Train Loss: ', train_loss, '\n')
464
464
 
465
465
  # Display final visualizations
466
466
  display_visualizations_for_learner(viz_objects, best_weights, data, best_acc,
@@ -490,8 +490,8 @@ def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=Non
490
490
  y_pred_batch=train_model[get_preds_softmax()])
491
491
 
492
492
  print('\nActivations: ', final_activations)
493
- print(f'Train Accuracy (%{batch_size * 100} of train samples):', train_model[get_acc()])
494
- print(f'Train Loss (%{batch_size * 100} of train samples): ', train_loss, '\n')
493
+ print(f'Train Accuracy:', train_model[get_acc()])
494
+ print(f'Train Loss: ', train_loss, '\n')
495
495
 
496
496
  # Display final visualizations
497
497
  display_visualizations_for_learner(viz_objects, best_weights, data, best_acc,
@@ -509,8 +509,8 @@ def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=Non
509
509
  train_loss = binary_crossentropy(y_true_batch=y_train, y_pred_batch=train_model[get_preds_softmax()])
510
510
 
511
511
  print('\nActivations: ', final_activations)
512
- print(f'Train Accuracy (%{batch_size * 100} of train samples):', train_model[get_acc()])
513
- print(f'Train Loss (%{batch_size * 100} of train samples): ', train_loss, '\n')
512
+ print(f'Train Accuracy:', train_model[get_acc()])
513
+ print(f'Train Loss: ', train_loss, '\n')
514
514
 
515
515
  # Display final visualizations
516
516
  display_visualizations_for_learner(viz_objects, best_weights, data, best_acc, train_loss, y_train, interval)
@@ -620,19 +620,18 @@ def evaluate(
620
620
  loading_bar = initialize_loading_bar(total=len(x_test), ncols=64, desc='Testing', bar_format=bar_format_normal)
621
621
 
622
622
  for inpIndex in range(len(x_test)):
623
- Input = x_test[inpIndex].ravel()
623
+ Input = transfer_to_gpu(x_test[inpIndex], dtype=dtype).ravel()
624
624
  neural_layer = Input
625
625
 
626
- neural_layer = feed_forward(neural_layer, W, is_training=False, Class='?', activation_potentiation=activation_potentiation)
626
+ neural_layer = feed_forward(neural_layer, cp.copy(W), is_training=False, Class='?', activation_potentiation=activation_potentiation)
627
627
 
628
628
  predict_probabilitys[inpIndex] = Softmax(neural_layer)
629
629
 
630
- RealOutput = cp.argmax(y_test[inpIndex])
630
+ RealOutput = decode_one_hot(transfer_to_gpu(y_test[inpIndex], dtype=y_test[inpIndex].dtype))
631
631
  real_classes[inpIndex] = RealOutput
632
632
  PredictedOutput = cp.argmax(neural_layer)
633
633
  predict_classes[inpIndex] = PredictedOutput
634
634
 
635
-
636
635
  if RealOutput == PredictedOutput:
637
636
  true_predict += 1
638
637
 
pyerualjetwork/planeat.py CHANGED
@@ -15,7 +15,6 @@ ANAPLAN document: https://github.com/HCB06/Anaplan/blob/main/Welcome_to_Anaplan/
15
15
  import numpy as np
16
16
  import random
17
17
  import math
18
- import copy
19
18
 
20
19
  ### LIBRARY IMPORTS ###
21
20
  from .plan import feed_forward
@@ -279,7 +278,7 @@ def evolver(weights,
279
278
 
280
279
  good_activations = list(activation_potentiations[slice_center:])
281
280
  bad_activations = list(activation_potentiations[:slice_center])
282
- best_activations = copy.deepcopy(good_activations[-1])
281
+ best_activations = good_activations[-1].copy() if isinstance(good_activations[-1], list) else good_activations[-1]
283
282
 
284
283
 
285
284
  ### PLANEAT IS APPLIED ACCORDING TO THE SPECIFIED POLICY, STRATEGY, AND PROBABILITY CONFIGURATION:
@@ -293,10 +292,10 @@ def evolver(weights,
293
292
  epsilon = np.finfo(float).eps
294
293
 
295
294
  child_W = np.copy(bad_weights)
296
- child_act = copy.deepcopy(bad_activations)
295
+ child_act = bad_activations.copy()
297
296
 
298
297
  mutated_W = np.copy(bad_weights)
299
- mutated_act = copy.deepcopy(bad_activations)
298
+ mutated_act = bad_activations.copy()
300
299
 
301
300
  for i in range(len(bad_weights)):
302
301
 
@@ -16,7 +16,6 @@ import cupy as cp
16
16
  import numpy as np
17
17
  import random
18
18
  import math
19
- import copy
20
19
 
21
20
 
22
21
  ### LIBRARY IMPORTS ###
@@ -279,7 +278,7 @@ def evolver(weights,
279
278
 
280
279
  good_activations = list(activation_potentiations[slice_center:])
281
280
  bad_activations = list(activation_potentiations[:slice_center])
282
- best_activations = copy.deepcopy(good_activations[-1])
281
+ best_activations = good_activations[-1].copy() if isinstance(good_activations[-1], list) else good_activations[-1]
283
282
 
284
283
 
285
284
  ### PLANEAT IS APPLIED ACCORDING TO THE SPECIFIED POLICY, STRATEGY, AND PROBABILITY CONFIGURATION:
@@ -293,10 +292,10 @@ def evolver(weights,
293
292
  epsilon = cp.finfo(float).eps
294
293
 
295
294
  child_W = cp.copy(bad_weights)
296
- child_act = copy.deepcopy(bad_activations)
295
+ child_act = bad_activations.copy()
297
296
 
298
297
  mutated_W = cp.copy(bad_weights)
299
- mutated_act = copy.deepcopy(bad_activations)
298
+ mutated_act = bad_activations.copy()
300
299
 
301
300
 
302
301
  for i in range(len(bad_weights)):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyerualjetwork
3
- Version: 4.2.9b6
3
+ Version: 4.3.0
4
4
  Summary: PyerualJetwork is a machine learning library supported with GPU(CUDA) acceleration written in Python for professionals and researchers including with PLAN algorithm, PLANEAT algorithm (genetic optimization). Also includes data pre-process and memory manegament
5
5
  Author: Hasan Can Beydili
6
6
  Author-email: tchasancan@gmail.com
@@ -24,6 +24,7 @@ GitHub Page: https://github.com/HCB06/PyerualJetwork
24
24
 
25
25
 
26
26
  pip install pyerualjetwork
27
+ pip install pyerualjetwork==x.x.x-jetstorm
27
28
 
28
29
  from pyerualjetwork import plan
29
30
  from pyerualjetwork import planeat
@@ -1,7 +1,7 @@
1
- pyerualjetwork/__init__.py,sha256=RinNIkDeJr4wF9YAHZGWDwyrjgrIjwK1lea0toxdUGM,641
2
- pyerualjetwork/activation_functions.py,sha256=WWOdMd5pI6ZKe-ieKCIsKAYPQODHuXYxx7tzhA5xjes,11767
3
- pyerualjetwork/activation_functions_cuda.py,sha256=KmXJ5Cdig46XAMYakXFPEOlxSxtFJjD21-i3nGtxPjE,11807
4
- pyerualjetwork/data_operations.py,sha256=pb5CqJ0Th6fCjTNMCtqQMiwH3KezTxAijacglsKUxmY,14730
1
+ pyerualjetwork/__init__.py,sha256=bh-WncqbgotASiAnBwCZ2YoOPk21dSp2rlAQNn_wkcU,639
2
+ pyerualjetwork/activation_functions.py,sha256=eLEesmMgDvkI1TqaLTpqtOgTaLbHEAyw-D57KIKd9G4,11775
3
+ pyerualjetwork/activation_functions_cuda.py,sha256=ztIw6rMR4t1289_TPIGYwE6qarl_YbSOGj5Ep3rUMqs,11803
4
+ pyerualjetwork/data_operations.py,sha256=Flteouu6rfSo2uHMqBHuzO02dXmbNa-I5qWmUpGTZ5Y,14760
5
5
  pyerualjetwork/data_operations_cuda.py,sha256=UpoJoFhIwTU4xg9dVuLAxLAT4CkRaGsxvtJG9j1xrNo,17629
6
6
  pyerualjetwork/help.py,sha256=nQ_YbYA2RtuafhuvkreNpX0WWL1I_nzlelwCtvei0_Y,775
7
7
  pyerualjetwork/loss_functions.py,sha256=6PyBI232SQRGuFnG3LDGvnv_PUdWzT2_2mUODJiejGI,618
@@ -11,14 +11,14 @@ pyerualjetwork/metrics.py,sha256=q7MkhnZDRbCjFBDDfUgrl8lBYnUT_1ro1LxeBq105pI,607
11
11
  pyerualjetwork/metrics_cuda.py,sha256=73h9GC7XwmnFCVzFEEiPQfF8CwHIz2wsCbxpZrJtYgw,5061
12
12
  pyerualjetwork/model_operations.py,sha256=RKqnh7-MByFosxqme4q4jC1lOndX26O-OVXYV6ZxoEE,12965
13
13
  pyerualjetwork/model_operations_cuda.py,sha256=XnKKq54ZLaqCm-NaJ6d8IToACKcKg2Ttq6moowVRRWo,13365
14
- pyerualjetwork/plan.py,sha256=UzCTFCA9cTv9ITCtsqfJ1g02rCMyescoIV6j1amvYGw,32134
15
- pyerualjetwork/plan_cuda.py,sha256=KbjCsG_j2GB56lKqDM_nYC74WC_5-CsYhYCFh2Y3MVg,33444
16
- pyerualjetwork/planeat.py,sha256=t6qyuMB2c5n8lsAJooEpShzEnw2GvepBI0bpLMx0DUI,39440
17
- pyerualjetwork/planeat_cuda.py,sha256=UBdbAk87M5zEZzZlRBeOzW-q0Sy8c_XWl4zdrtDnyIs,39499
14
+ pyerualjetwork/plan.py,sha256=ApMQC46_I8qtMqO4lLYLme--SGcMRg-GRo1-gSb3A3I,31894
15
+ pyerualjetwork/plan_cuda.py,sha256=H_EuNNyxrY6-AiuRkOYC8J_UmbzoqJ9aeO0i9pgUDZI,33277
16
+ pyerualjetwork/planeat.py,sha256=e-J-u5gJYijKznN6gn2DZoaCJJro84DOBYTy1rR5-y4,39470
17
+ pyerualjetwork/planeat_cuda.py,sha256=QNHCQLkR0MNFqyN2iHAtC7cbf8qZiD3p_54YH3lnMFA,39529
18
18
  pyerualjetwork/ui.py,sha256=wu2BhU1k-w3Kcho5Jtq4SEKe68ftaUeRGneUOSCVDjU,575
19
19
  pyerualjetwork/visualizations.py,sha256=1SKMZaJ80OD2qHUyMxW1IOv8zwmxzMPxclfbeq1Xr4g,28772
20
20
  pyerualjetwork/visualizations_cuda.py,sha256=KbMhfsLlxujy_i3QrwCf734Q-k6d7Zn_7CEbm3gzK9w,29186
21
- pyerualjetwork-4.2.9b6.dist-info/METADATA,sha256=aIMLQPX8Niv1NatXhbmrPkb2u1CfxlVSQAUxWWVSyKU,7454
22
- pyerualjetwork-4.2.9b6.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
23
- pyerualjetwork-4.2.9b6.dist-info/top_level.txt,sha256=BRyt62U_r3ZmJpj-wXNOoA345Bzamrj6RbaWsyW4tRg,15
24
- pyerualjetwork-4.2.9b6.dist-info/RECORD,,
21
+ pyerualjetwork-4.3.0.dist-info/METADATA,sha256=QyBQvs-G2foB8Jhj-SnwHIOWaYfX6pbyBJUw19nPvwU,7502
22
+ pyerualjetwork-4.3.0.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
23
+ pyerualjetwork-4.3.0.dist-info/top_level.txt,sha256=BRyt62U_r3ZmJpj-wXNOoA345Bzamrj6RbaWsyW4tRg,15
24
+ pyerualjetwork-4.3.0.dist-info/RECORD,,