pyerualjetwork 4.2.6b8__py3-none-any.whl → 4.2.7b1__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.6b8"
1
+ __version__ = "4.2.7b1"
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
@@ -81,18 +81,19 @@ def evolver(weights,
81
81
  bad_genomes_selection_prob=None,
82
82
  bar_status=True,
83
83
  strategy='normal_selective',
84
- bad_genomes_mutation_prob=None,
85
- activation_mutate_prob=0.5,
84
+ bad_genomes_mutation_prob=None,
86
85
  fitness_bias=None,
87
- cross_over_mode='tpm',
86
+ cross_over_mode='tpm',
88
87
  activation_mutate_add_prob=0.5,
89
88
  activation_mutate_delete_prob=0.5,
90
- activation_mutate_change_prob=0.5,
89
+ activation_mutate_change_prob=0.5,
90
+ activation_selection_add_prob=0.5,
91
+ activation_selection_change_prob=0.5,
92
+ activation_selection_threshold=2,
93
+ activation_mutate_prob=1,
94
+ activation_mutate_threshold=2,
95
+ weight_mutate_threshold=16,
91
96
  weight_mutate_prob=1,
92
- weight_mutate_rate=32,
93
- activation_selection_add_prob=0.6,
94
- activation_selection_change_prob=0.4,
95
- activation_selection_rate=2,
96
97
  dtype=np.float32):
97
98
  """
98
99
  Applies the evolving process of a population of genomes using selection, crossover, mutation, and activation function potentiation.
@@ -145,7 +146,7 @@ def evolver(weights,
145
146
  For example, a value of 0.7 for bad genomes implies 0.3 for best genomes. Default: Determined by `policy`.
146
147
 
147
148
  activation_mutate_prob (float, optional): The probability of applying mutation to the activation functions.
148
- Must be in the range [0, 1]. Default is 0.5 (50%).
149
+ Must be in the range [0, 1]. Default is 1 (%100).
149
150
 
150
151
  cross_over_mode (str, optional): Specifies the crossover method to use. Options:
151
152
  - 'tpm': Two-Point Matrix Crossover.
@@ -161,21 +162,21 @@ def evolver(weights,
161
162
  Must be in the range [0, 1]. Default is 0.5.
162
163
 
163
164
  weight_mutate_prob (float, optional): The probability of mutating a weight in the genome.
164
- Must be in the range [0, 1]. Default is 1.
165
+ Must be in the range [0, 1]. Default is 1 (%100).
165
166
 
166
- weight_mutate_rate (int, optional): If the value entered here equals the result of input_layer * output_layer,
167
- only a single weight will be mutated during each mutation process. If the value is half of the result,
168
- two weights will be mutated. WARNING: If you don't understand, do NOT change this value. Default is 32.
167
+ weight_mutate_threshold (int): Determines max how much weight mutaiton operation applying. (Function automaticly determines to min) Default: 16
169
168
 
170
169
  activation_selection_add_prob (float, optional): The probability of adding an existing activation function for crossover.
171
- Must be in the range [0, 1]. Default is 0.6. (WARNING! Higher values increase complexity. For faster training, increase this value.)
170
+ Must be in the range [0, 1]. Default is 0.5. (WARNING! Higher values increase complexity. For faster training, increase this value.)
172
171
 
173
172
  activation_selection_change_prob (float, optional): The probability of changing an activation function in the genome for crossover.
174
- Must be in the range [0, 1]. Default is 0.4.
173
+ Must be in the range [0, 1]. Default is 0.5.
174
+
175
+ activation_mutate_threshold (int, optional): Determines max how much activation mutaiton operation applying. (Function automaticly determines to min) Default: 2
175
176
 
176
- activation_selection_rate (int, optional): If the activation list of a good genome is smaller than this value, only one activation will undergo crossover. This parameter controls model complexity. Default is 2.
177
+ activation_selection_threshold (int, optional): Determines max how much activaton transferable to child from undominant parent. (Function automaticly determines to min) Default: 2
177
178
 
178
- dtype (numpy.dtype): Data type for the arrays. Default: np.float32.
179
+ dtype (numpy.dtype, optional): Data type for the arrays. Default: np.float32.
179
180
  Example: np.float64 or np.float16 [fp32 for balanced devices, fp64 for strong devices, fp16 for weak devices: not recommended!].
180
181
 
181
182
  Raises:
@@ -321,7 +322,7 @@ def evolver(weights,
321
322
  cross_over_mode=cross_over_mode,
322
323
  activation_selection_add_prob=activation_selection_add_prob,
323
324
  activation_selection_change_prob=activation_selection_change_prob,
324
- threshold=activation_selection_rate,
325
+ activation_selection_threshold=activation_selection_threshold,
325
326
  bad_genomes_selection_prob=bad_genomes_selection_prob,
326
327
  first_parent_fitness=best_fitness,
327
328
  fitness_bias=fitness_bias,
@@ -350,8 +351,10 @@ def evolver(weights,
350
351
  activation_delete_prob=activation_mutate_delete_prob,
351
352
  activation_change_prob=activation_mutate_change_prob,
352
353
  weight_mutate_prob=weight_mutate_prob,
353
- threshold=weight_mutate_rate,
354
- genome_fitness=normalized_fitness[fitness_index]
354
+ weight_mutate_threshold=weight_mutate_threshold,
355
+ genome_fitness=normalized_fitness[fitness_index],
356
+ activation_mutate_threshold=activation_mutate_threshold,
357
+ epsilon=epsilon
355
358
  )
356
359
 
357
360
  if bar_status: progress.update(1)
@@ -375,15 +378,16 @@ def evolver(weights,
375
378
  print(" GOOD GENOMES MUTATION PROB: ", str(round(1 - bad_genomes_mutation_prob, 2)))
376
379
  print(" BAD GENOMES SELECTION PROB: ", str(bad_genomes_selection_prob))
377
380
  print(" WEIGHT MUTATE PROB: ", str(weight_mutate_prob))
378
- print(" WEIGHT MUTATE RATE (THRESHOLD VALUE FOR SINGLE MUTATION): ", str(weight_mutate_rate))
381
+ print(" WEIGHT MUTATE THRESHOLD: ", str(weight_mutate_threshold))
379
382
  print(" ACTIVATION MUTATE PROB: ", str(activation_mutate_prob))
383
+ print(" ACTIVATION MUTATE THRESHOLD: ", str(activation_mutate_threshold))
380
384
  print(" ACTIVATION MUTATE ADD PROB: ", str(activation_mutate_add_prob))
381
385
  print(" ACTIVATION MUTATE DELETE PROB: ", str(activation_mutate_delete_prob))
382
386
  print(" ACTIVATION MUTATE CHANGE PROB: ", str(activation_mutate_change_prob))
387
+ print(" ACTIVATION SELECTION THRESHOLD:", str(activation_selection_threshold))
383
388
  print(" ACTIVATION SELECTION ADD PROB: ", str(activation_selection_add_prob))
384
389
  print(" ACTIVATION SELECTION CHANGE PROB: ", str(activation_selection_change_prob))
385
- print(" FITNESS BIAS: ", str(fitness_bias))
386
- print(" ACTIVATION SELECTION RATE (THRESHOLD VALUE FOR SINGLE CROSS OVER):", str(activation_selection_rate) + '\n')
390
+ print(" FITNESS BIAS: ", str(fitness_bias) + '\n')
387
391
 
388
392
 
389
393
  print("*** Performance ***")
@@ -477,7 +481,7 @@ def cross_over(first_parent_W,
477
481
  cross_over_mode,
478
482
  activation_selection_add_prob,
479
483
  activation_selection_change_prob,
480
- threshold,
484
+ activation_selection_threshold,
481
485
  bad_genomes_selection_prob,
482
486
  first_parent_fitness,
483
487
  second_parent_fitness,
@@ -506,8 +510,7 @@ def cross_over(first_parent_W,
506
510
  activation_selection_change_prob (float): Probability of replacing an activation function in the child genome
507
511
  with one from the second parent.
508
512
 
509
- threshold (float): Determines how quickly activation functions are added or replaced
510
- during the crossover process.
513
+ activation_selection_threshold (float): (float): Determines max how much activaton transferable to child from undominant parent. (Function automaticly determines to min)
511
514
 
512
515
  bad_genomes_selection_prob (float): Probability of selecting a "bad" genome for replacement with the offspring.
513
516
 
@@ -539,7 +542,7 @@ def cross_over(first_parent_W,
539
542
  cross_over_mode='tpm',
540
543
  activation_selection_add_prob=0.8,
541
544
  activation_selection_change_prob=0.5,
542
- threshold=2,
545
+ activation_selection_threshold=2,
543
546
  bad_genomes_selection_prob=0.7,
544
547
  first_parent_fitness=0.9,
545
548
  second_parent_fitness=0.85,
@@ -614,7 +617,7 @@ def cross_over(first_parent_W,
614
617
 
615
618
  if potential_activation_selection_add > activation_selection_add_prob:
616
619
 
617
- threshold = abs(threshold / succes)
620
+ threshold = abs(activation_selection_threshold / succes)
618
621
  new_threshold = threshold
619
622
 
620
623
  while True:
@@ -626,7 +629,6 @@ def cross_over(first_parent_W,
626
629
 
627
630
  if len(dominant_parent_act) > new_threshold:
628
631
  new_threshold += threshold
629
- pass
630
632
 
631
633
  else:
632
634
  break
@@ -649,7 +651,6 @@ def cross_over(first_parent_W,
649
651
 
650
652
  if len(dominant_parent_act) > new_threshold:
651
653
  new_threshold += threshold
652
- pass
653
654
 
654
655
  else:
655
656
  break
@@ -663,9 +664,10 @@ def mutation(weight,
663
664
  activation_delete_prob,
664
665
  activation_change_prob,
665
666
  weight_mutate_prob,
666
- threshold,
667
- genome_fitness
668
- ):
667
+ weight_mutate_threshold,
668
+ genome_fitness,
669
+ activation_mutate_threshold,
670
+ epsilon):
669
671
  """
670
672
  Performs mutation on the given weight matrix and activation functions.
671
673
  - The weight matrix is mutated by randomly changing its values based on the mutation probability.
@@ -686,9 +688,13 @@ def mutation(weight,
686
688
 
687
689
  weight_mutate_prob (float): The probability of mutating weight matrix.
688
690
 
689
- threshold (float): If the value you enter here is equal to the result of input layer * output layer, only a single weight will be mutated during each mutation process. If the value you enter here is half of the result of input layer * output layer, two weights in the weight matrix will be mutated.
691
+ weight_mutate_threshold (float): Determines max how much weight mutaiton operation applying. (Function automaticly determines to min)
690
692
 
691
- genome_fitness (float): Fitness value of genome
693
+ genome_fitness (float): Fitness (0-1) value of genome
694
+
695
+ activation_mutate_threshold (float): Determines max how much activation mutaiton operation applying. (Function automaticly determines to min)
696
+
697
+ epsilon (float): Small epsilon constant
692
698
 
693
699
  Returns:
694
700
  tuple: A tuple containing:
@@ -720,7 +726,7 @@ def mutation(weight,
720
726
 
721
727
  max_threshold = row_end * col_end
722
728
 
723
- threshold = threshold * genome_fitness
729
+ threshold = weight_mutate_threshold * genome_fitness
724
730
  new_threshold = threshold
725
731
 
726
732
  for _ in range(max_threshold):
@@ -729,57 +735,72 @@ def mutation(weight,
729
735
  selected_col = int(random.uniform(start, col_end))
730
736
 
731
737
  weight[selected_row, selected_col] = random.uniform(-1, 1)
738
+ new_threshold += threshold
732
739
 
733
740
  if max_threshold > new_threshold:
734
- new_threshold += threshold
741
+ pass
735
742
 
736
743
  else:
737
744
  break
738
745
 
739
-
740
- activation_mutate_prob = 1 - activation_mutate_prob
741
- potential_activation_mutation = random.uniform(0, 1)
746
+ activation_mutate_prob = 1 - activation_mutate_prob
747
+ potential_activation_mutation = random.uniform(0, 1)
742
748
 
743
- if potential_activation_mutation > activation_mutate_prob:
744
-
745
- except_this = ['spiral', 'circular']
746
- all_acts = [item for item in all_activations() if item not in except_this] # SPIRAL AND CIRCULAR ACTIVATION DISCARDED
747
-
748
- activation_add_prob = 1 - activation_add_prob
749
- activation_delete_prob = 1 - activation_delete_prob
750
- activation_change_prob = 1 - activation_change_prob
749
+ if potential_activation_mutation > activation_mutate_prob:
750
+
751
+ genome_fitness += epsilon
752
+ threshold = abs(activation_mutate_threshold / genome_fitness)
753
+ max_threshold = len(activations)
751
754
 
752
- potential_activation_add_prob = random.uniform(0, 1)
753
- potential_activation_delete_prob = random.uniform(0, 1)
754
- potential_activation_change_prob = random.uniform(0, 1)
755
+ new_threshold = threshold
755
756
 
756
- if potential_activation_add_prob > activation_add_prob:
757
+ except_this = ['spiral', 'circular']
758
+ all_acts = [item for item in all_activations() if item not in except_this] # SPIRAL AND CIRCULAR ACTIVATION DISCARDED
759
+
760
+ activation_add_prob = 1 - activation_add_prob
761
+ activation_delete_prob = 1 - activation_delete_prob
762
+ activation_change_prob = 1 - activation_change_prob
757
763
 
758
- try:
759
-
760
- random_index_all_act = int(random.uniform(0, len(all_acts)-1))
761
- activations.append(all_acts[random_index_all_act])
764
+ for _ in range(max_threshold):
762
765
 
763
- except:
766
+ potential_activation_add_prob = random.uniform(0, 1)
767
+ potential_activation_delete_prob = random.uniform(0, 1)
768
+ potential_activation_change_prob = random.uniform(0, 1)
764
769
 
765
- activation = activations
766
- activations = []
767
770
 
768
- activations.append(activation)
769
- activations.append(all_acts[int(random.uniform(0, len(all_acts)-1))])
770
-
771
- if potential_activation_delete_prob > activation_delete_prob and len(activations) > 1:
772
-
773
- random_index = random.randint(0, len(activations) - 1)
774
- activations.pop(random_index)
775
-
776
-
777
- if potential_activation_change_prob > activation_change_prob:
778
-
779
- random_index_all_act = int(random.uniform(0, len(all_acts)-1))
780
- random_index_genom_act = int(random.uniform(0, len(activations)-1))
771
+ if potential_activation_delete_prob > activation_delete_prob and len(activations) > 1:
772
+
773
+ random_index = random.randint(0, len(activations) - 1)
774
+ activations.pop(random_index)
775
+
776
+
777
+ if potential_activation_add_prob > activation_add_prob:
778
+
779
+ try:
780
+
781
+ random_index_all_act = int(random.uniform(0, len(all_acts)-1))
782
+ activations.append(all_acts[random_index_all_act])
783
+
784
+ except:
785
+
786
+ activation = activations
787
+ activations = []
788
+
789
+ activations.append(activation)
790
+ activations.append(all_acts[int(random.uniform(0, len(all_acts)-1))])
791
+
792
+
793
+ if potential_activation_change_prob > activation_change_prob:
794
+
795
+ random_index_all_act = int(random.uniform(0, len(all_acts)-1))
796
+ random_index_genom_act = int(random.uniform(0, len(activations)-1))
797
+
798
+ activations[random_index_genom_act] = all_acts[random_index_all_act]
799
+
800
+ new_threshold += threshold
781
801
 
782
- activations[random_index_genom_act] = all_acts[random_index_all_act]
802
+ if max_threshold > new_threshold: pass
803
+ else: break
783
804
 
784
805
  return weight, activations
785
806
 
@@ -83,18 +83,19 @@ def evolver(weights,
83
83
  bad_genomes_selection_prob=None,
84
84
  bar_status=True,
85
85
  strategy='normal_selective',
86
- bad_genomes_mutation_prob=None,
87
- activation_mutate_prob=0.5,
86
+ bad_genomes_mutation_prob=None,
88
87
  fitness_bias=None,
89
88
  cross_over_mode='tpm',
90
89
  activation_mutate_add_prob=0.5,
91
90
  activation_mutate_delete_prob=0.5,
92
- activation_mutate_change_prob=0.5,
91
+ activation_mutate_change_prob=0.5,
92
+ activation_selection_add_prob=0.5,
93
+ activation_selection_change_prob=0.5,
94
+ activation_selection_threshold=2,
95
+ activation_mutate_prob=1,
96
+ activation_mutate_threshold=2,
97
+ weight_mutate_threshold=16,
93
98
  weight_mutate_prob=1,
94
- weight_mutate_rate=32,
95
- activation_selection_add_prob=0.6,
96
- activation_selection_change_prob=0.4,
97
- activation_selection_rate=2,
98
99
  dtype=cp.float32):
99
100
  """
100
101
  Applies the evolving process of a population of genomes using selection, crossover, mutation, and activation function potentiation.
@@ -165,17 +166,17 @@ def evolver(weights,
165
166
  weight_mutate_prob (float, optional): The probability of mutating a weight in the genome.
166
167
  Must be in the range [0, 1]. Default is 1.
167
168
 
168
- weight_mutate_rate (int, optional): If the value entered here equals the result of input_layer * output_layer,
169
- only a single weight will be mutated during each mutation process. If the value is half of the result,
170
- two weights will be mutated. WARNING: If you don't understand, do NOT change this value. Default is 32.
169
+ weight_mutate_threshold (int): Determines max how much weight mutaiton operation applying. (Function automaticly determines to min) Default: 16
171
170
 
172
171
  activation_selection_add_prob (float, optional): The probability of adding an existing activation function for crossover.
173
- Must be in the range [0, 1]. Default is 0.6. (WARNING! Higher values increase complexity. For faster training, increase this value.)
172
+ Must be in the range [0, 1]. Default is 0.5. (WARNING! Higher values increase complexity. For faster training, increase this value.)
174
173
 
175
174
  activation_selection_change_prob (float, optional): The probability of changing an activation function in the genome for crossover.
176
- Must be in the range [0, 1]. Default is 0.4.
175
+ Must be in the range [0, 1]. Default is 0.5.
176
+
177
+ activation_mutate_threshold (int): Determines max how much activation mutaiton operation applying. (Function automaticly determines to min) Default: 2
177
178
 
178
- activation_selection_rate (int, optional): If the activation list of a good genome is smaller than this value, only one activation will undergo crossover. This parameter controls model complexity. Default is 2.
179
+ activation_selection_threshold (int, optional): Determines max how much activaton transferable to child from undominant parent. (Function automaticly determines to min) Default: 2
179
180
 
180
181
  dtype (cupy.dtype): Data type for the arrays. Default: cp.float32.
181
182
  Example: cp.float64 or cp.float16 [fp32 for balanced devices, fp64 for strong devices, fp16 for weak devices: not recommended!].
@@ -322,7 +323,7 @@ def evolver(weights,
322
323
  cross_over_mode=cross_over_mode,
323
324
  activation_selection_add_prob=activation_selection_add_prob,
324
325
  activation_selection_change_prob=activation_selection_change_prob,
325
- threshold=activation_selection_rate,
326
+ activation_selection_threshold=activation_selection_threshold,
326
327
  bad_genomes_selection_prob=bad_genomes_selection_prob,
327
328
  first_parent_fitness=best_fitness,
328
329
  fitness_bias=fitness_bias,
@@ -351,8 +352,10 @@ def evolver(weights,
351
352
  activation_delete_prob=activation_mutate_delete_prob,
352
353
  activation_change_prob=activation_mutate_change_prob,
353
354
  weight_mutate_prob=weight_mutate_prob,
354
- threshold=weight_mutate_rate,
355
- genome_fitness=normalized_fitness[fitness_index]
355
+ weight_mutate_threshold=weight_mutate_threshold,
356
+ genome_fitness=normalized_fitness[fitness_index],
357
+ activation_mutate_threshold=activation_mutate_threshold,
358
+ epsilon=epsilon
356
359
  )
357
360
 
358
361
  if bar_status: progress.update(1)
@@ -374,17 +377,19 @@ def evolver(weights,
374
377
  print(" POLICY: ", policy)
375
378
  print(" BAD GENOMES MUTATION PROB: ", str(bad_genomes_mutation_prob))
376
379
  print(" GOOD GENOMES MUTATION PROB: ", str(round(1 - bad_genomes_mutation_prob, 2)))
380
+ print(" BAD GENOMES SELECTION PROB: ", str(bad_genomes_selection_prob))
377
381
  print(" WEIGHT MUTATE PROB: ", str(weight_mutate_prob))
378
- print(" WEIGHT MUTATE RATE (THRESHOLD VALUE FOR SINGLE MUTATION): ", str(weight_mutate_rate))
382
+ print(" WEIGHT MUTATE THRESHOLD: ", str(weight_mutate_threshold))
379
383
  print(" ACTIVATION MUTATE PROB: ", str(activation_mutate_prob))
384
+ print(" ACTIVATION MUTATE THRESHOLD: ", str(activation_mutate_threshold))
380
385
  print(" ACTIVATION MUTATE ADD PROB: ", str(activation_mutate_add_prob))
381
386
  print(" ACTIVATION MUTATE DELETE PROB: ", str(activation_mutate_delete_prob))
382
387
  print(" ACTIVATION MUTATE CHANGE PROB: ", str(activation_mutate_change_prob))
388
+ print(" ACTIVATION SELECTION THRESHOLD:", str(activation_selection_threshold))
383
389
  print(" ACTIVATION SELECTION ADD PROB: ", str(activation_selection_add_prob))
384
390
  print(" ACTIVATION SELECTION CHANGE PROB: ", str(activation_selection_change_prob))
385
- print(" FITNESS BIAS: ", str(fitness_bias))
386
- print(" ACTIVATION SELECTION RATE (THRESHOLD VALUE FOR SINGLE CROSS OVER):", str(activation_selection_rate) + '\n')
387
-
391
+ print(" FITNESS BIAS: ", str(fitness_bias) + '\n')
392
+
388
393
  print("*** Performance ***")
389
394
  print(" MAX FITNESS: ", str(cp.round(max(fitness), 2)))
390
395
  print(" MEAN FITNESS: ", str(cp.round(cp.mean(fitness), 2)))
@@ -480,7 +485,7 @@ def cross_over(first_parent_W,
480
485
  cross_over_mode,
481
486
  activation_selection_add_prob,
482
487
  activation_selection_change_prob,
483
- threshold,
488
+ activation_selection_threshold,
484
489
  bad_genomes_selection_prob,
485
490
  first_parent_fitness,
486
491
  second_parent_fitness,
@@ -509,8 +514,7 @@ def cross_over(first_parent_W,
509
514
  activation_selection_change_prob (float): Probability of replacing an activation function in the child genome
510
515
  with one from the second parent.
511
516
 
512
- threshold (float): Determines how quickly activation functions are added or replaced
513
- during the crossover process.
517
+ activation_selection_threshold (int): Determines max how much activaton transferable to child from undominant parent. (Function automaticly determines to min)
514
518
 
515
519
  bad_genomes_selection_prob (float): Probability of selecting a "bad" genome for replacement with the offspring.
516
520
 
@@ -542,7 +546,7 @@ def cross_over(first_parent_W,
542
546
  cross_over_mode='tpm',
543
547
  activation_selection_add_prob=0.8,
544
548
  activation_selection_change_prob=0.5,
545
- threshold=2,
549
+ activation_selection_threshold=2,
546
550
  bad_genomes_selection_prob=0.7,
547
551
  first_parent_fitness=0.9,
548
552
  second_parent_fitness=0.85,
@@ -618,7 +622,7 @@ def cross_over(first_parent_W,
618
622
 
619
623
  if potential_activation_selection_add > activation_selection_add_prob:
620
624
 
621
- threshold = threshold / succes
625
+ threshold = abs(activation_selection_threshold / succes)
622
626
  new_threshold = threshold
623
627
 
624
628
  while True:
@@ -627,9 +631,9 @@ def cross_over(first_parent_W,
627
631
  random_undominant_activation = undominant_parent_act[random_index]
628
632
 
629
633
  child_act.append(random_undominant_activation)
634
+ new_threshold += threshold
630
635
 
631
636
  if len(dominant_parent_act) > new_threshold:
632
- new_threshold += threshold
633
637
  pass
634
638
 
635
639
  else:
@@ -640,7 +644,7 @@ def cross_over(first_parent_W,
640
644
 
641
645
  if potential_activation_selection_change_prob > activation_selection_change_prob:
642
646
 
643
- threshold = threshold / succes
647
+ threshold = abs(threshold / succes)
644
648
  new_threshold = threshold
645
649
 
646
650
  while True:
@@ -650,9 +654,9 @@ def cross_over(first_parent_W,
650
654
  random_undominant_activation = undominant_parent_act[random_index_undominant]
651
655
 
652
656
  child_act[random_index_dominant] = random_undominant_activation
657
+ new_threshold += threshold
653
658
 
654
659
  if len(dominant_parent_act) > new_threshold:
655
- new_threshold += threshold
656
660
  pass
657
661
 
658
662
  else:
@@ -668,8 +672,10 @@ def mutation(weight,
668
672
  activation_delete_prob,
669
673
  activation_change_prob,
670
674
  weight_mutate_prob,
671
- threshold,
672
- genome_fitness):
675
+ weight_mutate_threshold,
676
+ genome_fitness,
677
+ activation_mutate_threshold,
678
+ epsilon):
673
679
  """
674
680
  Performs mutation on the given weight matrix and activation functions.
675
681
  - The weight matrix is mutated by randomly changing its values based on the mutation probability.
@@ -690,10 +696,13 @@ def mutation(weight,
690
696
 
691
697
  weight_mutate_prob (float): The probability of mutating weight matrix.
692
698
 
693
- threshold (float): If the value you enter here is equal to the result of input layer * output layer, only a single weight will be mutated during each mutation process. If the value you enter here is half of the result of input layer * output layer, two weights in the weight matrix will be mutated.
699
+ weight_mutate_threshold (float): Determines max how much weight mutaiton operation applying. (Function automaticly determines to min)
694
700
 
695
701
  genome_fitness (float): Fitness value of genome
696
702
 
703
+ activation_mutate_threshold (float): Determines max how much activation mutaiton operation applying. (Function automaticly determines to min)
704
+
705
+ epsilon (float): Small epsilon constant
697
706
 
698
707
  Returns:
699
708
  tuple: A tuple containing:
@@ -725,7 +734,7 @@ def mutation(weight,
725
734
 
726
735
  max_threshold = row_end * col_end
727
736
 
728
- threshold = threshold * genome_fitness
737
+ threshold = weight_mutate_threshold * genome_fitness
729
738
  new_threshold = threshold
730
739
 
731
740
  for _ in range(max_threshold):
@@ -734,56 +743,71 @@ def mutation(weight,
734
743
  selected_col = int(random.uniform(start, col_end))
735
744
 
736
745
  weight[selected_row, selected_col] = random.uniform(-1, 1)
746
+ new_threshold += threshold
737
747
 
738
748
  if max_threshold > new_threshold:
739
- new_threshold += threshold
749
+ pass
740
750
 
741
751
  else:
742
752
  break
743
-
744
- activation_mutate_prob = 1 - activation_mutate_prob
745
- potential_activation_mutation = random.uniform(0, 1)
746
753
 
747
- if potential_activation_mutation > activation_mutate_prob:
748
-
749
- except_this = ['spiral', 'circular']
750
- all_acts = [item for item in all_activations() if item not in except_this] # SPIRAL AND CIRCULAR ACTIVATION DISCARDED
751
-
752
- activation_add_prob = 1 - activation_add_prob
753
- activation_delete_prob = 1 - activation_delete_prob
754
- activation_change_prob = 1 - activation_change_prob
754
+ activation_mutate_prob = 1 - activation_mutate_prob
755
+ potential_activation_mutation = random.uniform(0, 1)
756
+
757
+ if potential_activation_mutation > activation_mutate_prob:
758
+
759
+ genome_fitness += epsilon
760
+ threshold = abs(activation_mutate_threshold / genome_fitness)
761
+ max_threshold = len(activations)
762
+
763
+ new_threshold = threshold
764
+
765
+ except_this = ['spiral', 'circular']
766
+ all_acts = [item for item in all_activations() if item not in except_this] # SPIRAL AND CIRCULAR ACTIVATION DISCARDED
767
+
768
+ activation_add_prob = 1 - activation_add_prob
769
+ activation_delete_prob = 1 - activation_delete_prob
770
+ activation_change_prob = 1 - activation_change_prob
755
771
 
756
- potential_activation_add_prob = random.uniform(0, 1)
757
- potential_activation_delete_prob = random.uniform(0, 1)
758
- potential_activation_change_prob = random.uniform(0, 1)
772
+ for _ in range(max_threshold):
759
773
 
760
- if potential_activation_add_prob > activation_add_prob:
774
+ potential_activation_add_prob = random.uniform(0, 1)
775
+ potential_activation_delete_prob = random.uniform(0, 1)
776
+ potential_activation_change_prob = random.uniform(0, 1)
761
777
 
762
- try:
763
778
 
764
- random_index_all_act = int(random.uniform(0, len(all_acts)-1))
765
- activations.append(all_acts[random_index_all_act])
779
+ if potential_activation_delete_prob > activation_delete_prob and len(activations) > 1:
780
+
781
+ random_index = random.randint(0, len(activations) - 1)
782
+ activations.pop(random_index)
783
+
766
784
 
767
- except:
785
+ if potential_activation_add_prob > activation_add_prob:
768
786
 
769
- activation = activations
770
- activations = []
787
+ try:
788
+
789
+ random_index_all_act = int(random.uniform(0, len(all_acts)-1))
790
+ activations.append(all_acts[random_index_all_act])
771
791
 
772
- activations.append(activation)
773
- activations.append(all_acts[int(random.uniform(0, len(all_acts)-1))])
774
-
775
- if potential_activation_delete_prob > activation_delete_prob and len(activations) > 1:
776
-
777
- random_index = random.randint(0, len(activations) - 1)
778
- activations.pop(random_index)
779
-
780
-
781
- if potential_activation_change_prob > activation_change_prob:
782
-
783
- random_index_all_act = int(random.uniform(0, len(all_acts)-1))
784
- random_index_genom_act = int(random.uniform(0, len(activations)-1))
792
+ except:
793
+
794
+ activation = activations
795
+ activations = []
796
+
797
+ activations.append(activation)
798
+ activations.append(all_acts[int(random.uniform(0, len(all_acts)-1))])
799
+
800
+ if potential_activation_change_prob > activation_change_prob:
801
+
802
+ random_index_all_act = int(random.uniform(0, len(all_acts)-1))
803
+ random_index_genom_act = int(random.uniform(0, len(activations)-1))
804
+
805
+ activations[random_index_genom_act] = all_acts[random_index_all_act]
806
+
807
+ new_threshold += threshold
785
808
 
786
- activations[random_index_genom_act] = all_acts[random_index_all_act]
809
+ if max_threshold > new_threshold: pass
810
+ else: break
787
811
 
788
812
  return weight, activations
789
813
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyerualjetwork
3
- Version: 4.2.6b8
3
+ Version: 4.2.7b1
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=YWqrIcXhOQjha7hQXj1uWc-ZjE13OkHcsVXv3_-IGX4,641
1
+ pyerualjetwork/__init__.py,sha256=x7gCnkzpKBs0dwRH5vVDO7hmumg7qo2rRaExaFRz_N0,641
2
2
  pyerualjetwork/activation_functions.py,sha256=WWOdMd5pI6ZKe-ieKCIsKAYPQODHuXYxx7tzhA5xjes,11767
3
3
  pyerualjetwork/activation_functions_cuda.py,sha256=KmXJ5Cdig46XAMYakXFPEOlxSxtFJjD21-i3nGtxPjE,11807
4
4
  pyerualjetwork/data_operations.py,sha256=pb5CqJ0Th6fCjTNMCtqQMiwH3KezTxAijacglsKUxmY,14730
@@ -13,12 +13,12 @@ pyerualjetwork/model_operations.py,sha256=RKqnh7-MByFosxqme4q4jC1lOndX26O-OVXYV6
13
13
  pyerualjetwork/model_operations_cuda.py,sha256=XnKKq54ZLaqCm-NaJ6d8IToACKcKg2Ttq6moowVRRWo,13365
14
14
  pyerualjetwork/plan.py,sha256=UzCTFCA9cTv9ITCtsqfJ1g02rCMyescoIV6j1amvYGw,32134
15
15
  pyerualjetwork/plan_cuda.py,sha256=hpXZl3h7B1qAVYW-gZebwKMZd4-ftAZ-u05teOJjsno,33525
16
- pyerualjetwork/planeat.py,sha256=cDr0QfOD4FFibcpgsnyQiSpRUwkfYHkBJGqxBnyzx9Q,38893
17
- pyerualjetwork/planeat_cuda.py,sha256=uwbEU_GG3TSaIYUhaU8k13n3bSwFDhCWug4kSLvOHb4,38846
16
+ pyerualjetwork/planeat.py,sha256=FlMiMTlk9GAwswu8aYGPvfX8q7EvuE83s4npk-QcrDI,39866
17
+ pyerualjetwork/planeat_cuda.py,sha256=El29ecxPL_9pT2_DUFQcRWTzy9WAbwv5zmjokXPvnTk,39916
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.6b8.dist-info/METADATA,sha256=y-mt0kx3VmyrZE-0FYe3VOlHSTL0qweaLW2moncD0A0,7454
22
- pyerualjetwork-4.2.6b8.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
23
- pyerualjetwork-4.2.6b8.dist-info/top_level.txt,sha256=BRyt62U_r3ZmJpj-wXNOoA345Bzamrj6RbaWsyW4tRg,15
24
- pyerualjetwork-4.2.6b8.dist-info/RECORD,,
21
+ pyerualjetwork-4.2.7b1.dist-info/METADATA,sha256=lwHpKVg95g0XF_Lg61qtGuBFzjfC1PBVrdpP0la3Il4,7454
22
+ pyerualjetwork-4.2.7b1.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
23
+ pyerualjetwork-4.2.7b1.dist-info/top_level.txt,sha256=BRyt62U_r3ZmJpj-wXNOoA345Bzamrj6RbaWsyW4tRg,15
24
+ pyerualjetwork-4.2.7b1.dist-info/RECORD,,