pyerualjetwork 4.3.8.dev15__py3-none-any.whl → 4.3.9__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.
Files changed (43) hide show
  1. pyerualjetwork/__init__.py +1 -1
  2. pyerualjetwork/activation_functions.py +2 -2
  3. pyerualjetwork/activation_functions_cuda.py +63 -114
  4. pyerualjetwork/data_operations_cuda.py +1 -1
  5. pyerualjetwork/fitness_functions.py +72 -0
  6. pyerualjetwork/fitness_functions_cuda.py +85 -0
  7. pyerualjetwork/model_operations.py +14 -14
  8. pyerualjetwork/model_operations_cuda.py +16 -17
  9. pyerualjetwork/plan.py +159 -382
  10. pyerualjetwork/plan_cuda.py +149 -387
  11. pyerualjetwork/planeat.py +24 -54
  12. pyerualjetwork/planeat_cuda.py +11 -47
  13. pyerualjetwork/visualizations.py +33 -30
  14. pyerualjetwork/visualizations_cuda.py +22 -24
  15. {pyerualjetwork-4.3.8.dev15.dist-info → pyerualjetwork-4.3.9.dist-info}/METADATA +3 -19
  16. pyerualjetwork-4.3.9.dist-info/RECORD +24 -0
  17. pyerualjetwork-4.3.9.dist-info/top_level.txt +1 -0
  18. pyerualjetwork/loss_functions.py +0 -21
  19. pyerualjetwork/loss_functions_cuda.py +0 -21
  20. pyerualjetwork-4.3.8.dev15.dist-info/RECORD +0 -45
  21. pyerualjetwork-4.3.8.dev15.dist-info/top_level.txt +0 -2
  22. pyerualjetwork_afterburner/__init__.py +0 -11
  23. pyerualjetwork_afterburner/activation_functions.py +0 -290
  24. pyerualjetwork_afterburner/activation_functions_cuda.py +0 -289
  25. pyerualjetwork_afterburner/data_operations.py +0 -406
  26. pyerualjetwork_afterburner/data_operations_cuda.py +0 -461
  27. pyerualjetwork_afterburner/help.py +0 -17
  28. pyerualjetwork_afterburner/loss_functions.py +0 -21
  29. pyerualjetwork_afterburner/loss_functions_cuda.py +0 -21
  30. pyerualjetwork_afterburner/memory_operations.py +0 -298
  31. pyerualjetwork_afterburner/metrics.py +0 -190
  32. pyerualjetwork_afterburner/metrics_cuda.py +0 -163
  33. pyerualjetwork_afterburner/model_operations.py +0 -408
  34. pyerualjetwork_afterburner/model_operations_cuda.py +0 -420
  35. pyerualjetwork_afterburner/parallel.py +0 -118
  36. pyerualjetwork_afterburner/plan.py +0 -432
  37. pyerualjetwork_afterburner/plan_cuda.py +0 -441
  38. pyerualjetwork_afterburner/planeat.py +0 -793
  39. pyerualjetwork_afterburner/planeat_cuda.py +0 -752
  40. pyerualjetwork_afterburner/ui.py +0 -22
  41. pyerualjetwork_afterburner/visualizations.py +0 -823
  42. pyerualjetwork_afterburner/visualizations_cuda.py +0 -825
  43. {pyerualjetwork-4.3.8.dev15.dist-info → pyerualjetwork-4.3.9.dist-info}/WHEEL +0 -0
pyerualjetwork/planeat.py CHANGED
@@ -17,10 +17,9 @@ import random
17
17
  import math
18
18
 
19
19
  ### LIBRARY IMPORTS ###
20
- from .plan import feed_forward
21
20
  from .data_operations import normalization
22
21
  from .ui import loading_bars, initialize_loading_bar
23
- from. activation_functions import apply_activation, all_activations
22
+ from .activation_functions import apply_activation, all_activations
24
23
 
25
24
  def define_genomes(input_shape, output_shape, population_size, dtype=np.float32):
26
25
  """
@@ -297,6 +296,7 @@ def evolver(weights,
297
296
  mutated_W = np.copy(bad_weights)
298
297
  mutated_act = bad_activations.copy()
299
298
 
299
+
300
300
  for i in range(len(bad_weights)):
301
301
 
302
302
  if policy == 'aggressive':
@@ -399,7 +399,7 @@ def evolver(weights,
399
399
  return weights, activation_potentiations
400
400
 
401
401
 
402
- def evaluate(x_population, weights, activation_potentiations, rl_mode=False, dtype=np.float32):
402
+ def evaluate(x_population, weights, activation_potentiations):
403
403
  """
404
404
  Evaluates the performance of a population of genomes, applying different activation functions
405
405
  and weights depending on whether reinforcement learning mode is enabled or not.
@@ -412,62 +412,30 @@ def evaluate(x_population, weights, activation_potentiations, rl_mode=False, dty
412
412
  activation_potentiations (list or str): A list where each entry represents an activation function
413
413
  or a potentiation strategy applied to each genome. If only one
414
414
  activation function is used, this can be a single string.
415
- rl_mode (bool, optional): If True, reinforcement learning mode is activated, this accepts x_population is a single genome. (Also weights and activation_potentations a single genomes part.)
416
- Default is False.
417
-
418
- dtype (numpy.dtype): Data type for the arrays. np.float32 by default. Example: np.float64 or np.float16. [fp32 for balanced devices, fp64 for strong devices, fp16 for weak devices: not reccomended!] (optional)
419
-
420
415
  Returns:
421
416
  list: A list of outputs corresponding to each genome in the population after applying the respective
422
417
  activation function and weights.
423
418
 
424
- Notes:
425
- - If `rl_mode` is True:
426
- - Accepts x_population is a single genom
427
- - The inputs are flattened, and the activation function is applied across the single genom.
428
-
429
- - If `rl_mode` is False:
430
- - Accepts x_population is a list of genomes
431
- - Each genome is processed individually, and the results are stored in the `outputs` list.
432
-
433
- - `feed_forward()` function is the core function that processes the input with the given weights and activation function.
434
-
435
419
  Example:
436
420
  ```python
437
- outputs = evaluate(x_population, weights, activation_potentiations, rl_mode=False)
421
+ outputs = evaluate(x_population, weights, activation_potentiations)
438
422
  ```
439
423
 
440
424
  - The function returns a list of outputs after processing the population, where each element corresponds to
441
425
  the output for each genome in `x_population`.
442
- """
426
+ """
427
+ ### THE OUTPUTS ARE RETURNED, WHERE EACH GENOME'S OUTPUT MATCHES ITS INDEX:
443
428
 
444
- ### IF RL_MODE IS TRUE, A SINGLE GENOME IS ASSUMED AS INPUT, A FEEDFORWARD PREDICTION IS MADE, AND THE OUTPUT(NPARRAY) IS RETURNED:
445
-
446
- ### IF RL_MODE IS FALSE, PREDICTIONS ARE MADE FOR ALL GENOMES IN THE GROUP USING THEIR CORRESPONDING INDEXED INPUTS AND DATA.
447
- ### THE OUTPUTS ARE RETURNED AS A PYTHON LIST, WHERE EACH GENOME'S OUTPUT MATCHES ITS INDEX:
448
-
449
- if rl_mode == True:
450
- Input = np.array(x_population, copy=False, dtype=dtype)
451
- Input = Input.ravel()
452
-
453
- if isinstance(activation_potentiations, str):
454
- activation_potentiations = [activation_potentiations]
455
-
456
- outputs = feed_forward(Input=Input, is_training=False, activation_potentiation=activation_potentiations, w=weights)
457
-
458
- else:
459
- outputs = [0] * len(x_population)
460
- for i, genome in enumerate(x_population):
461
429
 
462
- Input = np.array(genome, copy=False)
463
- Input = Input.ravel()
464
-
465
- if isinstance(activation_potentiations[i], str):
466
- activation_potentiations[i] = [activation_potentiations[i]]
430
+ if isinstance(activation_potentiations, str):
431
+ activation_potentiations = [activation_potentiations]
432
+ else:
433
+ activation_potentiations = [item if isinstance(item, list) else [item] for item in activation_potentiations]
467
434
 
468
- outputs[i] = feed_forward(Input=Input, is_training=False, activation_potentiation=activation_potentiations[i], w=weights[i])
435
+ x_population = apply_activation(x_population, activation_potentiations)
436
+ result = x_population @ weights.T
469
437
 
470
- return outputs
438
+ return result
471
439
 
472
440
 
473
441
  def cross_over(first_parent_W,
@@ -592,11 +560,11 @@ def cross_over(first_parent_W,
592
560
  selection_bias = random.uniform(0, 1)
593
561
 
594
562
  if fitness_bias > selection_bias:
595
- row_cut_start = math.floor(row_cut_start * (succes + epsilon))
596
- row_cut_end = math.ceil(row_cut_end * (succes + epsilon))
563
+ row_cut_start = math.floor(row_cut_start * succes)
564
+ row_cut_end = math.ceil(row_cut_end * succes)
597
565
 
598
- col_cut_start = math.floor(col_cut_start * (succes + epsilon))
599
- col_cut_end = math.ceil(col_cut_end * (succes + epsilon))
566
+ col_cut_start = math.floor(col_cut_start * succes)
567
+ col_cut_end = math.ceil(col_cut_end * succes)
600
568
 
601
569
  child_W = dominant_parent_W
602
570
 
@@ -622,9 +590,10 @@ def cross_over(first_parent_W,
622
590
  random_undominant_activation = undominant_parent_act[random_index]
623
591
 
624
592
  child_act.append(random_undominant_activation)
625
-
593
+ new_threshold += threshold
594
+
626
595
  if len(dominant_parent_act) > new_threshold:
627
- new_threshold += threshold
596
+ pass
628
597
 
629
598
  else:
630
599
  break
@@ -644,9 +613,10 @@ def cross_over(first_parent_W,
644
613
  random_undominant_activation = undominant_parent_act[random_index_undominant]
645
614
 
646
615
  child_act[random_index_dominant] = random_undominant_activation
647
-
616
+ new_threshold += threshold
617
+
648
618
  if len(dominant_parent_act) > new_threshold:
649
- new_threshold += threshold
619
+ pass
650
620
 
651
621
  else:
652
622
  break
@@ -722,7 +692,7 @@ def mutation(weight,
722
692
 
723
693
  max_threshold = row_end * col_end
724
694
 
725
- threshold = weight_mutate_threshold * genome_fitness
695
+ threshold = weight_mutate_threshold * (genome_fitness + epsilon)
726
696
  new_threshold = threshold
727
697
 
728
698
  for _ in range(max_threshold):
@@ -19,7 +19,6 @@ import math
19
19
 
20
20
 
21
21
  ### LIBRARY IMPORTS ###
22
- from .plan_cuda import feed_forward
23
22
  from .data_operations_cuda import normalization
24
23
  from .ui import loading_bars, initialize_loading_bar
25
24
  from .activation_functions_cuda import apply_activation, all_activations
@@ -399,7 +398,7 @@ def evolver(weights,
399
398
  return weights, activation_potentiations
400
399
 
401
400
 
402
- def evaluate(x_population, weights, activation_potentiations, rl_mode=False, dtype=cp.float32):
401
+ def evaluate(x_population, weights, activation_potentiations):
403
402
  """
404
403
  Evaluates the performance of a population of genomes, applying different activation functions
405
404
  and weights depending on whether reinforcement learning mode is enabled or not.
@@ -414,64 +413,29 @@ def evaluate(x_population, weights, activation_potentiations, rl_mode=False, dty
414
413
  activation_potentiations (list or str): A list where each entry represents an activation function
415
414
  or a potentiation strategy applied to each genome. If only one
416
415
  activation function is used, this can be a single string.
417
-
418
- rl_mode (bool, optional): If True, reinforcement learning mode is activated, this accepts x_population is a single genome. (Also weights and activation_potentations a single genomes part.)
419
- Default is False.
420
-
421
-
422
- dtype (cupy.dtype): Data type for the arrays. np.float32 by default. Example: cp.float64 or cp.float16. [fp32 for balanced devices, fp64 for strong devices, fp16 for weak devices: not reccomended!] (optional)
423
-
424
416
  Returns:
425
417
  list: A list of outputs corresponding to each genome in the population after applying the respective
426
418
  activation function and weights.
427
419
 
428
- Notes:
429
- - If `rl_mode` is True:
430
- - Accepts x_population is a single genom
431
- - The inputs are flattened, and the activation function is applied across the single genom.
432
-
433
- - If `rl_mode` is False:
434
- - Accepts x_population is a list of genomes
435
- - Each genome is processed individually, and the results are stored in the `outputs` list.
436
-
437
- - `feed_forward()` function is the core function that processes the input with the given weights and activation function.
438
-
439
420
  Example:
440
421
  ```python
441
- outputs = evaluate(x_population, weights, activation_potentiations, rl_mode=False)
422
+ outputs = evaluate(x_population, weights, activation_potentiations)
442
423
  ```
443
424
 
444
425
  - The function returns a list of outputs after processing the population, where each element corresponds to
445
426
  the output for each genome in `x_population`.
446
427
  """
428
+ ### THE OUTPUTS ARE RETURNED WHERE EACH GENOME'S OUTPUT MATCHES ITS INDEX:
447
429
 
448
- ### IF RL_MODE IS TRUE, A SINGLE GENOME IS ASSUMED AS INPUT, A FEEDFORWARD PREDICTION IS MADE, AND THE OUTPUT(NPARRAY) IS RETURNED:
449
-
450
- ### IF RL_MODE IS FALSE, PREDICTIONS ARE MADE FOR ALL GENOMES IN THE GROUP USING THEIR CORRESPONDING INDEXED INPUTS AND DATA.
451
- ### THE OUTPUTS ARE RETURNED AS A PYTHON LIST, WHERE EACH GENOME'S OUTPUT MATCHES ITS INDEX:
452
-
453
- if rl_mode == True:
454
- Input = cp.array(x_population, dtype=dtype, copy=False)
455
- Input = Input.ravel()
456
-
457
- if isinstance(activation_potentiations, str):
458
- activation_potentiations = [activation_potentiations]
459
-
460
- outputs = feed_forward(Input=Input, is_training=False, activation_potentiation=activation_potentiations, w=weights)
461
-
430
+ if isinstance(activation_potentiations, str):
431
+ activation_potentiations = [activation_potentiations]
462
432
  else:
463
- outputs = [0] * len(x_population)
464
- for i, genome in enumerate(x_population):
433
+ activation_potentiations = [item if isinstance(item, list) else [item] for item in activation_potentiations]
465
434
 
466
- Input = cp.array(genome)
467
- Input = Input.ravel()
435
+ x_population = apply_activation(x_population, activation_potentiations)
436
+ result = x_population @ weights.T
468
437
 
469
- if isinstance(activation_potentiations[i], str):
470
- activation_potentiations[i] = [activation_potentiations[i]]
471
-
472
- outputs[i] = feed_forward(Input=Input, is_training=False, activation_potentiation=activation_potentiations[i], w=weights[i])
473
-
474
- return outputs
438
+ return result
475
439
 
476
440
 
477
441
  def cross_over(first_parent_W,
@@ -730,7 +694,7 @@ def mutation(weight,
730
694
 
731
695
  max_threshold = row_end * col_end
732
696
 
733
- threshold = weight_mutate_threshold * genome_fitness
697
+ threshold = weight_mutate_threshold * (genome_fitness + epsilon)
734
698
  new_threshold = threshold
735
699
 
736
700
  for _ in range(max_threshold):
@@ -757,7 +721,7 @@ def mutation(weight,
757
721
  max_threshold = len(activations)
758
722
 
759
723
  new_threshold = threshold
760
-
724
+
761
725
  except_this = ['spiral', 'circular']
762
726
  all_acts = [item for item in all_activations() if item not in except_this] # SPIRAL AND CIRCULAR ACTIVATION DISCARDED
763
727
 
@@ -323,7 +323,8 @@ def draw_activations(x_train, activation):
323
323
  except:
324
324
  print('\rWARNING: error in drawing some activation.', end='')
325
325
  return x_train
326
-
326
+
327
+
327
328
  def plot_evaluate(x_test, y_test, y_preds, acc_list, W, activation_potentiation):
328
329
 
329
330
  from .metrics import metrics, confusion_matrix, roc_curve
@@ -447,8 +448,7 @@ def plot_evaluate(x_test, y_test, y_preds, acc_list, W, activation_potentiation)
447
448
  axs[1,1].set_title('Decision Boundary')
448
449
 
449
450
  except Exception as e:
450
- # Hata meydana geldiğinde yapılacak işlemler
451
- print(f"Hata oluştu: {e}")
451
+ print(f"Error: {e}")
452
452
 
453
453
  plt.show()
454
454
 
@@ -614,10 +614,10 @@ def update_neuron_history(LTPW, ax1, row, col, class_count, artist5, fig1, acc=F
614
614
 
615
615
  fig1.suptitle(suptitle_info, fontsize=16)
616
616
 
617
-
617
+ """ DISABLED
618
618
  def initialize_visualization_for_fit(val, show_training, neurons_history, x_train, y_train):
619
- """Initializes the visualization setup based on the parameters."""
620
- from data_operations import find_closest_factors
619
+
620
+ from .data_operations import find_closest_factors
621
621
  visualization_objects = {}
622
622
 
623
623
  if show_training or neurons_history:
@@ -649,32 +649,33 @@ def initialize_visualization_for_fit(val, show_training, neurons_history, x_trai
649
649
  })
650
650
 
651
651
  return visualization_objects
652
-
652
+ """
653
653
 
654
-
654
+ """ DISABLED
655
655
  def update_neural_web_for_fit(W, ax, G, artist):
656
- """
657
- The function `update_neural_web_for_fit` updates a neural web visualization for fitting.
658
- """
656
+
659
657
  art5_1, art5_2, art5_3 = draw_neural_web(W=W, ax=ax, G=G, return_objs=True)
660
658
  art5_list = [art5_1] + [art5_2] + list(art5_3.values())
661
659
  artist.append(art5_list)
662
-
663
-
660
+ """
661
+
662
+ """ DISABLED
664
663
  def update_weight_visualization_for_fit(ax, LTPW, artist2):
665
- """Updates the weight visualization plot."""
664
+
666
665
  art2 = ax.imshow(LTPW, interpolation='sinc', cmap='viridis')
667
666
  artist2.append([art2])
667
+ """
668
668
 
669
-
669
+ """ DISABLED
670
670
  def update_decision_boundary_for_fit(ax, x_val, y_val, activation_potentiation, LTPW, artist1):
671
- """Updates the decision boundary visualization."""
671
+
672
672
  art1_1, art1_2 = plot_decision_boundary(x_val, y_val, activation_potentiation, LTPW, artist=artist1, ax=ax)
673
673
  artist1.append([*art1_1.collections, art1_2])
674
+ """
674
675
 
675
-
676
+ """ DISABLED
676
677
  def update_validation_history_for_fit(ax, val_list, artist3):
677
- """Updates the validation accuracy history plot."""
678
+
678
679
  period = list(range(1, len(val_list) + 1))
679
680
  art3 = ax.plot(
680
681
  period,
@@ -691,20 +692,22 @@ def update_validation_history_for_fit(ax, val_list, artist3):
691
692
  ax.set_ylabel('Validation Accuracy')
692
693
  ax.set_ylim([0, 1])
693
694
  artist3.append(art3)
694
-
695
-
695
+ """
696
+
697
+ """ DISABLED
696
698
  def display_visualization_for_fit(fig, artist_list, interval):
697
- """Displays the animation for the given artist list."""
699
+
698
700
  ani = ArtistAnimation(fig, artist_list, interval=interval, blit=True)
699
701
  return ani
700
-
702
+ """
703
+
701
704
  def show():
702
705
  plt.tight_layout()
703
706
  plt.show()
704
707
 
705
708
  def initialize_visualization_for_learner(show_history, neurons_history, neural_web_history, x_train, y_train):
706
- """Initialize all visualization components"""
707
- from data_operations import find_closest_factors
709
+
710
+ from .data_operations import find_closest_factors
708
711
  viz_objects = {}
709
712
 
710
713
  if show_history:
@@ -745,15 +748,15 @@ def initialize_visualization_for_learner(show_history, neurons_history, neural_w
745
748
  return viz_objects
746
749
 
747
750
  def update_history_plots_for_learner(viz_objects, depth_list, loss_list, best_acc_per_depth_list, x_train, final_activations):
748
- """Update history visualization plots"""
751
+
749
752
  if 'history' not in viz_objects:
750
753
  return
751
754
 
752
755
  hist = viz_objects['history']
753
756
 
754
- # Loss plot
755
- art1 = hist['ax'][0].plot(depth_list, loss_list, color='r', markersize=6, linewidth=2)
756
- hist['ax'][0].set_title('Train Loss Over Gen')
757
+ # Fitness plot
758
+ art1 = hist['ax'][0].plot(depth_list, loss_list, color='m', markersize=6, linewidth=2)
759
+ hist['ax'][0].set_title('Fitness Score Over Gen')
757
760
  hist['artist1'].append(art1)
758
761
 
759
762
  # Accuracy plot
@@ -768,11 +771,11 @@ def update_history_plots_for_learner(viz_objects, depth_list, loss_list, best_ac
768
771
  translated_x_train += draw_activations(x, activation)
769
772
 
770
773
  art3 = hist['ax'][2].plot(x, translated_x_train, color='b', markersize=6, linewidth=2)
771
- hist['ax'][2].set_title('Potentiation Shape Over Gen')
774
+ hist['ax'][2].set_title('Activation Shape Over Gen')
772
775
  hist['artist3'].append(art3)
773
776
 
774
777
  def display_visualizations_for_learner(viz_objects, best_weights, data, best_acc, test_loss, y_train, interval):
775
- """Display all final visualizations"""
778
+
776
779
  if 'history' in viz_objects:
777
780
  hist = viz_objects['history']
778
781
  for _ in range(30):
@@ -448,7 +448,7 @@ def plot_evaluate(x_test, y_test, y_preds, acc_list, W, activation_potentiation)
448
448
 
449
449
  plt.show()
450
450
 
451
-
451
+
452
452
  def plot_decision_boundary(x, y, activation_potentiation, W, artist=None, ax=None):
453
453
 
454
454
  from .model_operations_cuda import predict_model_ram
@@ -583,9 +583,8 @@ def update_neuron_history(LTPW, ax1, row, col, class_count, artist5, fig1, acc=F
583
583
 
584
584
  fig1.suptitle(suptitle_info, fontsize=16)
585
585
 
586
-
586
+ """ DISABLED
587
587
  def initialize_visualization_for_fit(val, show_training, neurons_history, x_train, y_train):
588
- """Initializes the visualization setup based on the parameters."""
589
588
  from .data_operations_cuda import find_closest_factors
590
589
  visualization_objects = {}
591
590
 
@@ -618,33 +617,34 @@ def initialize_visualization_for_fit(val, show_training, neurons_history, x_trai
618
617
  })
619
618
 
620
619
  return visualization_objects
620
+ """
621
+
621
622
 
622
-
623
+ """ DISABLED
623
624
  def update_weight_visualization_for_fit(ax, LTPW, artist2):
624
- """Updates the weight visualization plot."""
625
625
  art2 = ax.imshow(LTPW.get(), interpolation='sinc', cmap='viridis')
626
626
  artist2.append([art2])
627
+ """
627
628
 
628
629
  def show():
629
630
  plt.tight_layout()
630
631
  plt.show()
631
632
 
633
+ """ DISABLED
632
634
  def update_neural_web_for_fit(W, ax, G, artist):
633
- """
634
- The function `update_neural_web_for_fit` updates a neural web visualization for fitting.
635
- """
636
635
  art5_1, art5_2, art5_3 = draw_neural_web(W=W, ax=ax, G=G, return_objs=True)
637
636
  art5_list = [art5_1] + [art5_2] + list(art5_3.values())
638
637
  artist.append(art5_list)
639
-
638
+ """
639
+
640
+ """ DISABLED
640
641
  def update_decision_boundary_for_fit(ax, x_val, y_val, activation_potentiation, LTPW, artist1):
641
- """Updates the decision boundary visualization."""
642
642
  art1_1, art1_2 = plot_decision_boundary(x_val, y_val, activation_potentiation, LTPW, artist=artist1, ax=ax)
643
643
  artist1.append([*art1_1.collections, art1_2])
644
+ """
644
645
 
645
-
646
+ """ DISABLED
646
647
  def update_validation_history_for_fit(ax, val_list, artist3):
647
- """Updates the validation accuracy history plot."""
648
648
  val_list_cpu = []
649
649
  for i in range(len(val_list)):
650
650
  val_list_cpu.append(val_list[i].get())
@@ -664,13 +664,12 @@ def update_validation_history_for_fit(ax, val_list, artist3):
664
664
  ax.set_ylabel('Validation Accuracy')
665
665
  ax.set_ylim([0, 1])
666
666
  artist3.append(art3)
667
-
668
-
667
+ """
668
+ """ DISABLED
669
669
  def display_visualization_for_fit(fig, artist_list, interval):
670
- """Displays the animation for the given artist list."""
671
670
  ani = ArtistAnimation(fig, artist_list, interval=interval, blit=True)
672
671
  return ani
673
-
672
+ """
674
673
  def update_neuron_history_for_learner(LTPW, ax1, row, col, class_count, artist5, data, fig1, acc=False, loss=False):
675
674
 
676
675
  for j in range(len(class_count)):
@@ -699,7 +698,7 @@ def update_neuron_history_for_learner(LTPW, ax1, row, col, class_count, artist5,
699
698
  return artist5
700
699
 
701
700
  def initialize_visualization_for_learner(show_history, neurons_history, neural_web_history, x_train, y_train):
702
- """Initialize all visualization components"""
701
+
703
702
  from .data_operations_cuda import find_closest_factors
704
703
  viz_objects = {}
705
704
 
@@ -741,7 +740,7 @@ def initialize_visualization_for_learner(show_history, neurons_history, neural_w
741
740
  return viz_objects
742
741
 
743
742
  def update_history_plots_for_learner(viz_objects, depth_list, loss_list, best_acc_per_depth_list, x_train, final_activations):
744
- """Update history visualization plots"""
743
+
745
744
  if 'history' not in viz_objects:
746
745
  return
747
746
 
@@ -749,13 +748,12 @@ def update_history_plots_for_learner(viz_objects, depth_list, loss_list, best_ac
749
748
  for i in range(len(loss_list)):
750
749
  loss_list[i] = loss_list[i].get()
751
750
 
752
- # Loss plot
753
- art1 = hist['ax'][0].plot(depth_list, loss_list, color='r', markersize=6, linewidth=2)
754
- hist['ax'][0].set_title('Train Loss Over Gen')
751
+ # Fitness plot
752
+ art1 = hist['ax'][0].plot(depth_list, loss_list, color='m', markersize=6, linewidth=2)
753
+ hist['ax'][0].set_title('Fitness Score Over Gen')
755
754
  hist['artist1'].append(art1)
756
755
 
757
756
  # Accuracy plot
758
-
759
757
  for i in range(len(best_acc_per_depth_list)):
760
758
  best_acc_per_depth_list[i] = best_acc_per_depth_list[i].get()
761
759
 
@@ -770,11 +768,11 @@ def update_history_plots_for_learner(viz_objects, depth_list, loss_list, best_ac
770
768
  translated_x_train += draw_activations(x, activation)
771
769
 
772
770
  art3 = hist['ax'][2].plot(x.get(), translated_x_train.get(), color='b', markersize=6, linewidth=2)
773
- hist['ax'][2].set_title('Potentiation Shape Over Gen')
771
+ hist['ax'][2].set_title('Activation Shape Over Gen')
774
772
  hist['artist3'].append(art3)
775
773
 
776
774
  def display_visualizations_for_learner(viz_objects, best_weights, data, best_acc, test_loss, y_train, interval):
777
- """Display all final visualizations"""
775
+
778
776
  if 'history' in viz_objects:
779
777
  hist = viz_objects['history']
780
778
  for _ in range(30):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyerualjetwork
3
- Version: 4.3.8.dev15
3
+ Version: 4.3.9
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
@@ -25,8 +25,6 @@ GitHub Page: https://github.com/HCB06/PyerualJetwork
25
25
  YouTube Tutorials: https://www.youtube.com/watch?v=6wMQstZ00is&list=PLNgNWpM7HbsBpCx2VTJ4SK9wcPyse-EHw
26
26
 
27
27
  pip install pyerualjetwork
28
-
29
- 'use this if your data small or memory management is a problem :'
30
28
 
31
29
  from pyerualjetwork import plan
32
30
  from pyerualjetwork import planeat
@@ -38,28 +36,14 @@ YouTube Tutorials: https://www.youtube.com/watch?v=6wMQstZ00is&list=PLNgNWpM7Hbs
38
36
  from pyerualjetwork import data_operations_cuda
39
37
  from pyerualjetwork import model_operations_cuda
40
38
 
41
- 'use this if your data large or memory management is not a problem : _afterburner package (afterburner package comes with powerful paralellism,
42
- afterburner with cuda modules offers super-fast training but some memory managemant features and visualization features discarded.
43
- Specially designed for LLM training and other massive model training)'
44
-
45
- from pyerualjetwork_afterburner import plan
46
- from pyerualjetwork_afterburner import planeat
47
- from pyerualjetwork_afterburner import data_operations
48
- from pyerualjetwork_afterburner import model_operations
49
-
50
- from pyerualjetwork_afterburner import plan_cuda
51
- from pyerualjetwork_afterburner import planeat_cuda
52
- from pyerualjetwork_afterburner import data_operations_cuda
53
- from pyerualjetwork_afterburner import model_operations_cuda
54
-
55
39
  Optimized for Visual Studio Code
56
40
 
57
41
  requires=[
58
42
  'scipy==1.13.1',
59
43
  'tqdm==4.66.4',
60
- 'seaborn==0.13.2',
61
44
  'pandas==2.2.2',
62
45
  'networkx==3.3',
46
+ 'seaborn==0.13.2',
63
47
  'numpy==1.26.4',
64
48
  'matplotlib==3.9.0',
65
49
  'colorama==0.4.6',
@@ -67,7 +51,7 @@ YouTube Tutorials: https://www.youtube.com/watch?v=6wMQstZ00is&list=PLNgNWpM7Hbs
67
51
  'psutil==6.1.1'
68
52
  ]
69
53
 
70
- matplotlib, seaborn, networkx (optional).
54
+ matplotlib, networkx (optional).
71
55
 
72
56
  ##############################
73
57
 
@@ -0,0 +1,24 @@
1
+ pyerualjetwork/__init__.py,sha256=6KJMDK9_sqh51dQW6kPoAtzHqs2Hb1LaGjYp9diHz48,639
2
+ pyerualjetwork/activation_functions.py,sha256=bKf00lsuuLJNO-4vVp4OqBi4zJ-qZ8L3v-vl52notkY,7721
3
+ pyerualjetwork/activation_functions_cuda.py,sha256=5y1Ti3GDfDteQDCUmODwe7tAyDAUlDTKmIikChQ8d6g,7772
4
+ pyerualjetwork/data_operations.py,sha256=Flteouu6rfSo2uHMqBHuzO02dXmbNa-I5qWmUpGTZ5Y,14760
5
+ pyerualjetwork/data_operations_cuda.py,sha256=ZcjmLXE1-HVwedextYdJZ1rgrns1OfSekzFpr1a9m6o,17625
6
+ pyerualjetwork/fitness_functions.py,sha256=kewx8yMtQFUO-9rjCD3n5z26X2vLeDsb0HPTIdizFF0,4084
7
+ pyerualjetwork/fitness_functions_cuda.py,sha256=ouUh8hhEvEcATBuKg2gOBuqEOyJoygHORC851OUZrO8,4360
8
+ pyerualjetwork/help.py,sha256=nQ_YbYA2RtuafhuvkreNpX0WWL1I_nzlelwCtvei0_Y,775
9
+ pyerualjetwork/memory_operations.py,sha256=I7QiZ--xSyRkFF0wcckPwZV7K9emEvyx5aJ3DiRHZFI,13468
10
+ pyerualjetwork/metrics.py,sha256=q7MkhnZDRbCjFBDDfUgrl8lBYnUT_1ro1LxeBq105pI,6077
11
+ pyerualjetwork/metrics_cuda.py,sha256=73h9GC7XwmnFCVzFEEiPQfF8CwHIz2wsCbxpZrJtYgw,5061
12
+ pyerualjetwork/model_operations.py,sha256=MCSCNYiiICRVZITobtS3ZIWmH5Q9gjyELuH32sAdgg4,12649
13
+ pyerualjetwork/model_operations_cuda.py,sha256=NT01BK5nrDYE7H1x3KnSI8gmx0QTGGB0mP_LqEb1uuU,13157
14
+ pyerualjetwork/plan.py,sha256=XetfEUOPzsA49wFEZ2P76LA_Huv4mTJ0EvbJhl1-Uhg,20435
15
+ pyerualjetwork/plan_cuda.py,sha256=NvhxDaXnUOIGKGdey35EvGH6fdCM3U_0LVmQz_GmJOA,20972
16
+ pyerualjetwork/planeat.py,sha256=QyfPW5k0rvVnowtymI3LXLKp39y69M5DIyNBAeKIhRQ,37568
17
+ pyerualjetwork/planeat_cuda.py,sha256=zzsEu612Ren5K8YyvIn00RjYBG9Z6AOikiReGAPrBbg,37624
18
+ pyerualjetwork/ui.py,sha256=wu2BhU1k-w3Kcho5Jtq4SEKe68ftaUeRGneUOSCVDjU,575
19
+ pyerualjetwork/visualizations.py,sha256=6uY9U4qGOlG4aIhGdAFcTm2Z5m9Hxww4tAAG61_Vqb8,28294
20
+ pyerualjetwork/visualizations_cuda.py,sha256=o6MyZUVz040lmdI2kGlOEU2IoxvyWJPhSOKe9vkLMvY,28753
21
+ pyerualjetwork-4.3.9.dist-info/METADATA,sha256=nAK5TyytTNMxU4Gs6170LQeUd-ol3yceaEKsKVcocac,7496
22
+ pyerualjetwork-4.3.9.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
23
+ pyerualjetwork-4.3.9.dist-info/top_level.txt,sha256=BRyt62U_r3ZmJpj-wXNOoA345Bzamrj6RbaWsyW4tRg,15
24
+ pyerualjetwork-4.3.9.dist-info/RECORD,,
@@ -0,0 +1 @@
1
+ pyerualjetwork
@@ -1,21 +0,0 @@
1
-
2
- import numpy as np
3
-
4
- def categorical_crossentropy(y_true_batch, y_pred_batch):
5
- epsilon = 1e-7
6
- y_pred_batch = np.clip(y_pred_batch, epsilon, 1. - epsilon)
7
-
8
- losses = -np.sum(y_true_batch * np.log(y_pred_batch), axis=1)
9
-
10
- mean_loss = np.mean(losses)
11
- return mean_loss
12
-
13
-
14
- def binary_crossentropy(y_true_batch, y_pred_batch):
15
- epsilon = 1e-7
16
- y_pred_batch = np.clip(y_pred_batch, epsilon, 1. - epsilon)
17
-
18
- losses = -np.mean(y_true_batch * np.log(y_pred_batch) + (1 - y_true_batch) * np.log(1 - y_pred_batch), axis=1)
19
-
20
- mean_loss = np.mean(losses)
21
- return mean_loss
@@ -1,21 +0,0 @@
1
-
2
- import cupy as cp
3
-
4
- def categorical_crossentropy(y_true_batch, y_pred_batch):
5
- epsilon = 1e-7
6
- y_pred_batch = cp.clip(y_pred_batch, epsilon, 1. - epsilon)
7
-
8
- losses = -cp.sum(y_true_batch * cp.log(y_pred_batch), axis=1)
9
-
10
- mean_loss = cp.mean(losses)
11
- return mean_loss
12
-
13
-
14
- def binary_crossentropy(y_true_batch, y_pred_batch):
15
- epsilon = 1e-7
16
- y_pred_batch = cp.clip(y_pred_batch, epsilon, 1. - epsilon)
17
-
18
- losses = -cp.mean(y_true_batch * cp.log(y_pred_batch) + (1 - y_true_batch) * cp.log(1 - y_pred_batch), axis=1)
19
-
20
- mean_loss = cp.mean(losses)
21
- return mean_loss