pyerualjetwork 4.3.9b4__py3-none-any.whl → 4.3.9b5__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.3.9b4"
1
+ __version__ = "4.3.9b5"
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__):
pyerualjetwork/planeat.py CHANGED
@@ -582,20 +582,11 @@ def cross_over(first_parent_W,
582
582
  if potential_activation_selection_add > activation_selection_add_prob:
583
583
 
584
584
  threshold = abs(activation_selection_threshold / succes)
585
- new_threshold = threshold
586
-
587
- while True:
588
-
589
- random_index = int(random.uniform(0, len(undominant_parent_act)-1))
590
- random_undominant_activation = undominant_parent_act[random_index]
585
+ num_elements = int(len(dominant_parent_act) / threshold)
591
586
 
592
- child_act.append(random_undominant_activation)
587
+ random_indices = [int(random.uniform(0, len(undominant_parent_act)-1)) for _ in range(num_elements)]
593
588
 
594
- if len(dominant_parent_act) > new_threshold:
595
- new_threshold += threshold
596
-
597
- else:
598
- break
589
+ child_act.extend([undominant_parent_act[i] for i in random_indices])
599
590
 
600
591
  activation_selection_change_prob = 1 - activation_selection_change_prob
601
592
  potential_activation_selection_change_prob = random.uniform(0, 1)
@@ -603,21 +594,12 @@ def cross_over(first_parent_W,
603
594
  if potential_activation_selection_change_prob > activation_selection_change_prob:
604
595
 
605
596
  threshold = abs(activation_selection_threshold / succes)
606
- new_threshold = threshold
607
-
608
- while True:
609
-
610
- random_index_undominant = int(random.uniform(0, len(undominant_parent_act)-1))
611
- random_index_dominant = int(random.uniform(0, len(dominant_parent_act)-1))
612
- random_undominant_activation = undominant_parent_act[random_index_undominant]
597
+ num_elements = min(len(dominant_parent_act), int(threshold))
613
598
 
614
- child_act[random_index_dominant] = random_undominant_activation
599
+ random_indices = random.choices(range(len(undominant_parent_act)), k=num_elements)
600
+
601
+ child_act.extend(undominant_parent_act[i] for i in random_indices)
615
602
 
616
- if len(dominant_parent_act) > new_threshold:
617
- new_threshold += threshold
618
-
619
- else:
620
- break
621
603
 
622
604
  return child_W, child_act
623
605
 
@@ -691,80 +673,50 @@ def mutation(weight,
691
673
  max_threshold = row_end * col_end
692
674
 
693
675
  threshold = weight_mutate_threshold * genome_fitness
694
- new_threshold = threshold
695
-
696
- for _ in range(max_threshold):
697
-
698
- selected_row = int(random.uniform(start, row_end))
699
- selected_col = int(random.uniform(start, col_end))
700
-
701
- weight[selected_row, selected_col] = random.uniform(-1, 1)
702
- new_threshold += threshold
703
-
704
- if max_threshold > new_threshold:
705
- pass
706
-
707
- else:
708
- break
709
-
710
- activation_mutate_prob = 1 - activation_mutate_prob
711
- potential_activation_mutation = random.uniform(0, 1)
676
+ num_mutations = int(max_threshold / threshold)
712
677
 
713
- if potential_activation_mutation > activation_mutate_prob:
714
-
715
- genome_fitness += epsilon
716
- threshold = abs(activation_mutate_threshold / genome_fitness)
717
- max_threshold = len(activations)
678
+ selected_rows = np.random.randint(start, row_end, size=num_mutations)
679
+ selected_cols = np.random.randint(start, col_end, size=num_mutations)
680
+ new_values = np.random.uniform(-1, 1, size=num_mutations)
681
+
682
+ weight[selected_rows, selected_cols] = new_values
718
683
 
719
- new_threshold = threshold
684
+ activation_mutate_prob = 1 - activation_mutate_prob
685
+ potential_activation_mutation = random.uniform(0, 1)
720
686
 
721
- except_this = ['spiral', 'circular']
722
- all_acts = [item for item in all_activations() if item not in except_this] # SPIRAL AND CIRCULAR ACTIVATION DISCARDED
687
+ if potential_activation_mutation > activation_mutate_prob:
723
688
 
724
- activation_add_prob = 1 - activation_add_prob
725
- activation_delete_prob = 1 - activation_delete_prob
726
- activation_change_prob = 1 - activation_change_prob
727
-
728
- for _ in range(max_threshold):
729
-
730
- potential_activation_add_prob = random.uniform(0, 1)
731
- potential_activation_delete_prob = random.uniform(0, 1)
732
- potential_activation_change_prob = random.uniform(0, 1)
733
-
734
-
735
- if potential_activation_delete_prob > activation_delete_prob and len(activations) > 1:
736
-
737
- random_index = random.randint(0, len(activations) - 1)
738
- activations.pop(random_index)
689
+ genome_fitness += epsilon
690
+ threshold = abs(activation_mutate_threshold / genome_fitness)
691
+ max_threshold = len(activations)
739
692
 
693
+ new_threshold = threshold
740
694
 
741
- if potential_activation_add_prob > activation_add_prob:
742
-
743
- try:
744
-
745
- random_index_all_act = int(random.uniform(0, len(all_acts)-1))
746
- activations.append(all_acts[random_index_all_act])
747
-
748
- except:
695
+ except_this = ['spiral', 'circular']
696
+ all_acts = [item for item in all_activations() if item not in except_this] # SPIRAL AND CIRCULAR ACTIVATION DISCARDED
697
+
698
+ activation_add_prob = 1 - activation_add_prob
699
+ activation_delete_prob = 1 - activation_delete_prob
700
+ activation_change_prob = 1 - activation_change_prob
749
701
 
750
- activation = activations
751
- activations = []
702
+ probabilities = [random.uniform(0, 1) for _ in range(max_threshold)]
703
+ new_threshold = threshold
752
704
 
753
- activations.append(activation)
754
- activations.append(all_acts[int(random.uniform(0, len(all_acts)-1))])
755
-
756
-
757
- if potential_activation_change_prob > activation_change_prob:
758
-
759
- random_index_all_act = int(random.uniform(0, len(all_acts)-1))
760
- random_index_genom_act = int(random.uniform(0, len(activations)-1))
705
+ for p_add, p_delete, p_change in zip(
706
+ probabilities, random.sample(probabilities, len(probabilities)), random.sample(probabilities, len(probabilities))
707
+ ):
708
+ if p_delete > activation_delete_prob and len(activations) > 1:
709
+ activations.pop(random.randint(0, len(activations) - 1))
761
710
 
762
- activations[random_index_genom_act] = all_acts[random_index_all_act]
711
+ if p_add > activation_add_prob:
712
+ activations.append(random.choice(all_acts))
763
713
 
764
- new_threshold += threshold
714
+ if p_change > activation_change_prob:
715
+ activations[random.randint(0, len(activations) - 1)] = random.choice(all_acts)
765
716
 
766
- if max_threshold > new_threshold: pass
767
- else: break
717
+ new_threshold += threshold
718
+ if max_threshold <= new_threshold:
719
+ break
768
720
 
769
721
  return weight, activations
770
722
 
@@ -425,7 +425,7 @@ def evaluate(x_population, weights, activation_potentiations):
425
425
  - The function returns a list of outputs after processing the population, where each element corresponds to
426
426
  the output for each genome in `x_population`.
427
427
  """
428
- ### THE OUTPUTS ARE RETURNED AS A PYTHON LIST, WHERE EACH GENOME'S OUTPUT MATCHES ITS INDEX:
428
+ ### THE OUTPUTS ARE RETURNED WHERE EACH GENOME'S OUTPUT MATCHES ITS INDEX:
429
429
 
430
430
  if isinstance(activation_potentiations, str):
431
431
  activation_potentiations = [activation_potentiations]
@@ -583,21 +583,11 @@ def cross_over(first_parent_W,
583
583
  if potential_activation_selection_add > activation_selection_add_prob:
584
584
 
585
585
  threshold = abs(activation_selection_threshold / succes)
586
- new_threshold = threshold
587
-
588
- while True:
589
-
590
- random_index = int(random.uniform(0, len(undominant_parent_act)-1))
591
- random_undominant_activation = undominant_parent_act[random_index]
586
+ num_elements = int(len(dominant_parent_act) / threshold)
592
587
 
593
- child_act.append(random_undominant_activation)
594
- new_threshold += threshold
588
+ random_indices = [int(random.uniform(0, len(undominant_parent_act)-1)) for _ in range(num_elements)]
595
589
 
596
- if len(dominant_parent_act) > new_threshold:
597
- pass
598
-
599
- else:
600
- break
590
+ child_act.extend([undominant_parent_act[i] for i in random_indices])
601
591
 
602
592
  activation_selection_change_prob = 1 - activation_selection_change_prob
603
593
  potential_activation_selection_change_prob = random.uniform(0, 1)
@@ -605,22 +595,12 @@ def cross_over(first_parent_W,
605
595
  if potential_activation_selection_change_prob > activation_selection_change_prob:
606
596
 
607
597
  threshold = abs(activation_selection_threshold / succes)
608
- new_threshold = threshold
609
-
610
- while True:
611
-
612
- random_index_undominant = int(random.uniform(0, len(undominant_parent_act)-1))
613
- random_index_dominant = int(random.uniform(0, len(dominant_parent_act)-1))
614
- random_undominant_activation = undominant_parent_act[random_index_undominant]
598
+ num_elements = min(len(dominant_parent_act), int(threshold))
615
599
 
616
- child_act[random_index_dominant] = random_undominant_activation
617
- new_threshold += threshold
600
+ random_indices = random.choices(range(len(undominant_parent_act)), k=num_elements)
601
+
602
+ child_act.extend(undominant_parent_act[i] for i in random_indices)
618
603
 
619
- if len(dominant_parent_act) > new_threshold:
620
- pass
621
-
622
- else:
623
- break
624
604
 
625
605
  return child_W, child_act
626
606
 
@@ -695,79 +675,50 @@ def mutation(weight,
695
675
  max_threshold = row_end * col_end
696
676
 
697
677
  threshold = weight_mutate_threshold * genome_fitness
698
- new_threshold = threshold
699
-
700
- for _ in range(max_threshold):
701
-
702
- selected_row = int(random.uniform(start, row_end))
703
- selected_col = int(random.uniform(start, col_end))
704
-
705
- weight[selected_row, selected_col] = random.uniform(-1, 1)
706
- new_threshold += threshold
678
+ num_mutations = int(max_threshold / threshold)
707
679
 
708
- if max_threshold > new_threshold:
709
- pass
710
-
711
- else:
712
- break
713
-
714
- activation_mutate_prob = 1 - activation_mutate_prob
715
- potential_activation_mutation = random.uniform(0, 1)
716
-
717
- if potential_activation_mutation > activation_mutate_prob:
718
-
719
- genome_fitness += epsilon
720
- threshold = abs(activation_mutate_threshold / genome_fitness)
721
- max_threshold = len(activations)
722
-
723
- new_threshold = threshold
724
-
725
- except_this = ['spiral', 'circular']
726
- all_acts = [item for item in all_activations() if item not in except_this] # SPIRAL AND CIRCULAR ACTIVATION DISCARDED
727
-
728
- activation_add_prob = 1 - activation_add_prob
729
- activation_delete_prob = 1 - activation_delete_prob
730
- activation_change_prob = 1 - activation_change_prob
731
-
732
- for _ in range(max_threshold):
733
-
734
- potential_activation_add_prob = random.uniform(0, 1)
735
- potential_activation_delete_prob = random.uniform(0, 1)
736
- potential_activation_change_prob = random.uniform(0, 1)
737
-
738
-
739
- if potential_activation_delete_prob > activation_delete_prob and len(activations) > 1:
740
-
741
- random_index = random.randint(0, len(activations) - 1)
742
- activations.pop(random_index)
743
-
680
+ selected_rows = cp.random.randint(start, row_end, size=num_mutations)
681
+ selected_cols = cp.random.randint(start, col_end, size=num_mutations)
682
+ new_values = cp.random.uniform(-1, 1, size=num_mutations)
683
+
684
+ weight[selected_rows, selected_cols] = new_values
744
685
 
745
- if potential_activation_add_prob > activation_add_prob:
686
+ activation_mutate_prob = 1 - activation_mutate_prob
687
+ potential_activation_mutation = random.uniform(0, 1)
746
688
 
747
- try:
748
-
749
- random_index_all_act = int(random.uniform(0, len(all_acts)-1))
750
- activations.append(all_acts[random_index_all_act])
689
+ if potential_activation_mutation > activation_mutate_prob:
690
+
691
+ genome_fitness += epsilon
692
+ threshold = abs(activation_mutate_threshold / genome_fitness)
693
+ max_threshold = len(activations)
751
694
 
752
- except:
695
+ new_threshold = threshold
696
+
697
+ except_this = ['spiral', 'circular']
698
+ all_acts = [item for item in all_activations() if item not in except_this] # SPIRAL AND CIRCULAR ACTIVATION DISCARDED
699
+
700
+ activation_add_prob = 1 - activation_add_prob
701
+ activation_delete_prob = 1 - activation_delete_prob
702
+ activation_change_prob = 1 - activation_change_prob
753
703
 
754
- activation = activations
755
- activations = []
704
+ probabilities = [random.uniform(0, 1) for _ in range(max_threshold)]
705
+ new_threshold = threshold
756
706
 
757
- activations.append(activation)
758
- activations.append(all_acts[int(random.uniform(0, len(all_acts)-1))])
759
-
760
- if potential_activation_change_prob > activation_change_prob:
761
-
762
- random_index_all_act = int(random.uniform(0, len(all_acts)-1))
763
- random_index_genom_act = int(random.uniform(0, len(activations)-1))
707
+ for p_add, p_delete, p_change in zip(
708
+ probabilities, random.sample(probabilities, len(probabilities)), random.sample(probabilities, len(probabilities))
709
+ ):
710
+ if p_delete > activation_delete_prob and len(activations) > 1:
711
+ activations.pop(random.randint(0, len(activations) - 1))
764
712
 
765
- activations[random_index_genom_act] = all_acts[random_index_all_act]
713
+ if p_add > activation_add_prob:
714
+ activations.append(random.choice(all_acts))
766
715
 
767
- new_threshold += threshold
716
+ if p_change > activation_change_prob:
717
+ activations[random.randint(0, len(activations) - 1)] = random.choice(all_acts)
768
718
 
769
- if max_threshold > new_threshold: pass
770
- else: break
719
+ new_threshold += threshold
720
+ if max_threshold <= new_threshold:
721
+ break
771
722
 
772
723
  return weight, activations
773
724
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyerualjetwork
3
- Version: 4.3.9b4
3
+ Version: 4.3.9b5
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
@@ -1,4 +1,4 @@
1
- pyerualjetwork/__init__.py,sha256=i1UoaTGfwx70UIzWUX_-6AfbU-_k7Gvd086YS6rPJ08,641
1
+ pyerualjetwork/__init__.py,sha256=TnfMF6gtFWhR_THUVWop8fLHqEWcVy-Y5orYzXPO7XQ,641
2
2
  pyerualjetwork/activation_functions.py,sha256=bKf00lsuuLJNO-4vVp4OqBi4zJ-qZ8L3v-vl52notkY,7721
3
3
  pyerualjetwork/activation_functions_cuda.py,sha256=5y1Ti3GDfDteQDCUmODwe7tAyDAUlDTKmIikChQ8d6g,7772
4
4
  pyerualjetwork/data_operations.py,sha256=Flteouu6rfSo2uHMqBHuzO02dXmbNa-I5qWmUpGTZ5Y,14760
@@ -13,12 +13,12 @@ pyerualjetwork/model_operations.py,sha256=MCSCNYiiICRVZITobtS3ZIWmH5Q9gjyELuH32s
13
13
  pyerualjetwork/model_operations_cuda.py,sha256=NT01BK5nrDYE7H1x3KnSI8gmx0QTGGB0mP_LqEb1uuU,13157
14
14
  pyerualjetwork/plan.py,sha256=uK-7GRXqH0ETIajOW6_B6pSyktKmHg1NE4COD7z1f7E,23536
15
15
  pyerualjetwork/plan_cuda.py,sha256=tNez_xvK6yuUiwotopqtERAJUCc7RiLx7W8VEG7RoQY,24392
16
- pyerualjetwork/planeat.py,sha256=Lq5R0aMS4UIdZdbUKsKDv5g0WLwYryomR3IQYb8vAa4,37573
17
- pyerualjetwork/planeat_cuda.py,sha256=SG7Oq1F2m3lJBbG9cgmu7q_ApmwSn2SvTpcbtEVAoDE,37630
16
+ pyerualjetwork/planeat.py,sha256=SeCbFebOlThMNTMX-acgVZswuztF22m_G2E4MRCSDs0,36231
17
+ pyerualjetwork/planeat_cuda.py,sha256=XIDJwZAuQyzrBvFyQtbnfTUWRWDPGFmM3SfUXBa8foA,36233
18
18
  pyerualjetwork/ui.py,sha256=wu2BhU1k-w3Kcho5Jtq4SEKe68ftaUeRGneUOSCVDjU,575
19
19
  pyerualjetwork/visualizations.py,sha256=08O5uEewuYiovZRX1uHWEHjn19LcnhndWYvqVN74xs0,28290
20
20
  pyerualjetwork/visualizations_cuda.py,sha256=PYRqj4QYUbuYMYcNwO8yaTPB-jK7E6kZHhTrAi0lwPU,28749
21
- pyerualjetwork-4.3.9b4.dist-info/METADATA,sha256=KAOOz0a3m7sBMQ4Y2n6Ki_4ZU_eT-HN2oZF_T-9jMJU,7476
22
- pyerualjetwork-4.3.9b4.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
23
- pyerualjetwork-4.3.9b4.dist-info/top_level.txt,sha256=BRyt62U_r3ZmJpj-wXNOoA345Bzamrj6RbaWsyW4tRg,15
24
- pyerualjetwork-4.3.9b4.dist-info/RECORD,,
21
+ pyerualjetwork-4.3.9b5.dist-info/METADATA,sha256=uOQkxMNenLMBcte5_XCjm8H-Q6Bo4Hm-L2k-XNq7jXc,7476
22
+ pyerualjetwork-4.3.9b5.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
23
+ pyerualjetwork-4.3.9b5.dist-info/top_level.txt,sha256=BRyt62U_r3ZmJpj-wXNOoA345Bzamrj6RbaWsyW4tRg,15
24
+ pyerualjetwork-4.3.9b5.dist-info/RECORD,,