pyerualjetwork 4.3.9b5__py3-none-any.whl → 4.3.9b7__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.9b5"
1
+ __version__ = "4.3.9b7"
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/plan.py CHANGED
@@ -83,7 +83,7 @@ def fit(
83
83
  return normalization(weight, dtype=dtype)
84
84
 
85
85
 
86
- def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=None, batch_size=1, pop_size=None,
86
+ def learner(x_train, y_train, optimizer, fit_start=True, strategy='accuracy', gen=None, batch_size=1, pop_size=None,
87
87
  neural_web_history=False, show_current_activations=False, auto_normalization=False,
88
88
  neurons_history=False, early_stop=False, loss='categorical_crossentropy', show_history=False,
89
89
  interval=33.33, target_acc=None, target_loss=None,
@@ -120,7 +120,7 @@ def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=Non
120
120
  interval=16.67)
121
121
  ```
122
122
 
123
- fit_start (bool): If the fit_start parameter is set to True, the initial generation population undergoes a simple short training process using the PLAN algorithm. This allows for a very robust starting point, especially for large and complex datasets. However, for small or relatively simple datasets, it may result in unnecessary computational overhead. When fit_start is True, completing the first generation may take slightly longer (this increase in computational cost applies only to the first generation and does not affect subsequent generations). If fit_start is set to False, the initial population will be entirely random. Options: True or False. The fit_start parameter is MANDATORY and must be provided.
123
+ fit_start (bool, optional): If the fit_start parameter is set to True, the initial generation population undergoes a simple short training process using the PLAN algorithm. This allows for a very robust starting point, especially for large and complex datasets. However, for small or relatively simple datasets, it may result in unnecessary computational overhead. When fit_start is True, completing the first generation may take slightly longer (this increase in computational cost applies only to the first generation and does not affect subsequent generations). If fit_start is set to False, the initial population will be entirely random. Options: True or False. Default: True
124
124
 
125
125
  strategy (str, optional): Learning strategy. (options: 'accuracy', 'f1', 'precision', 'recall'): 'accuracy', Maximizes train (or test if given) accuracy during learning. 'f1', Maximizes train (or test if given) f1 score during learning. 'precision', Maximizes train (or test if given) precision score during learning. 'recall', Maximizes train (or test if given) recall during learning. Default is 'accuracy'.
126
126
 
@@ -202,15 +202,15 @@ def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=Non
202
202
 
203
203
  if fit_start is False or pop_size > activation_potentiation_len:
204
204
  weight_pop, act_pop = define_genomes(input_shape=len(x_train[0]), output_shape=len(y_train[0]), population_size=pop_size, dtype=dtype)
205
-
206
- if start_this_act is not None and start_this_W is not None:
207
- weight_pop[0] = start_this_W
208
- act_pop[0] = start_this_act
209
205
 
210
206
  else:
211
207
  weight_pop = [0] * pop_size
212
208
  act_pop = [0] * pop_size
213
209
 
210
+ if start_this_act is not None and start_this_W is not None:
211
+ weight_pop[0] = start_this_W
212
+ act_pop[0] = start_this_act
213
+
214
214
  for i in range(gen):
215
215
  postfix_dict["Gen"] = str(i+1) + '/' + str(gen)
216
216
  progress.set_postfix(postfix_dict)
@@ -224,9 +224,12 @@ def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=Non
224
224
  x_train_batch, y_train_batch = batcher(x_train, y_train, batch_size=batch_size)
225
225
 
226
226
  if fit_start is True and i == 0 and j < activation_potentiation_len:
227
- act_pop[j] = activation_potentiation[j]
228
- W = fit(x_train_batch, y_train_batch, activation_potentiation=act_pop[j], auto_normalization=auto_normalization, dtype=dtype)
229
- weight_pop[j] = W
227
+ if start_this_act is not None and j == 0:
228
+ pass
229
+ else:
230
+ act_pop[j] = activation_potentiation[j]
231
+ W = fit(x_train_batch, y_train_batch, activation_potentiation=act_pop[j], auto_normalization=auto_normalization, dtype=dtype)
232
+ weight_pop[j] = W
230
233
 
231
234
  model = evaluate(x_train_batch, y_train_batch, W=weight_pop[j], activation_potentiation=act_pop[j])
232
235
  acc = model[get_acc()]
@@ -309,7 +312,7 @@ def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=Non
309
312
  if target_acc is not None and best_acc >= target_acc:
310
313
  progress.close()
311
314
  train_model = evaluate(x_train, y_train, W=best_weights,
312
- activation_potentiation=final_activations, dtype=dtype)
315
+ activation_potentiation=final_activations)
313
316
 
314
317
  if loss == 'categorical_crossentropy':
315
318
  train_loss = categorical_crossentropy(y_true_batch=y_train,
@@ -331,7 +334,7 @@ def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=Non
331
334
  if target_loss is not None and best_loss <= target_loss:
332
335
  progress.close()
333
336
  train_model = evaluate(x_train, y_train, W=best_weights,
334
- activation_potentiation=final_activations, dtype=dtype)
337
+ activation_potentiation=final_activations)
335
338
 
336
339
  if loss == 'categorical_crossentropy':
337
340
  train_loss = categorical_crossentropy(y_true_batch=y_train,
@@ -380,7 +383,7 @@ def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=Non
380
383
  if best_acc_per_gen_list[i] == best_acc_per_gen_list[i-1]:
381
384
  progress.close()
382
385
  train_model = evaluate(x_train, y_train, W=best_weights,
383
- activation_potentiation=final_activations, dtype=dtype)
386
+ activation_potentiation=final_activations)
384
387
 
385
388
  if loss == 'categorical_crossentropy':
386
389
  train_loss = categorical_crossentropy(y_true_batch=y_train,
@@ -401,7 +404,7 @@ def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=Non
401
404
  # Final evaluation
402
405
  progress.close()
403
406
  train_model = evaluate(x_train, y_train, W=best_weights,
404
- activation_potentiation=final_activations, dtype=dtype)
407
+ activation_potentiation=final_activations)
405
408
 
406
409
  if loss == 'categorical_crossentropy':
407
410
  train_loss = categorical_crossentropy(y_true_batch=y_train, y_pred_batch=train_model[get_preds_softmax()])
@@ -82,7 +82,7 @@ def fit(
82
82
  return normalization(weight, dtype=dtype)
83
83
 
84
84
 
85
- def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=None, batch_size=1, pop_size=None,
85
+ def learner(x_train, y_train, optimizer, fit_start=True, strategy='accuracy', gen=None, batch_size=1, pop_size=None,
86
86
  neural_web_history=False, show_current_activations=False, auto_normalization=False,
87
87
  neurons_history=False, early_stop=False, loss='categorical_crossentropy', show_history=False,
88
88
  interval=33.33, target_acc=None, target_loss=None,
@@ -118,7 +118,7 @@ def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=Non
118
118
  batch_size=0.05,
119
119
  interval=16.67)
120
120
  ```
121
- fit_start (bool): If the fit_start parameter is set to True, the initial generation population undergoes a simple short training process using the PLAN algorithm. This allows for a very robust starting point, especially for large and complex datasets. However, for small or relatively simple datasets, it may result in unnecessary computational overhead. When fit_start is True, completing the first generation may take slightly longer (this increase in computational cost applies only to the first generation and does not affect subsequent generations). If fit_start is set to False, the initial population will be entirely random. Options: True or False. The fit_start parameter is MANDATORY and must be provided.
121
+ fit_start (bool, optional): If the fit_start parameter is set to True, the initial generation population undergoes a simple short training process using the PLAN algorithm. This allows for a very robust starting point, especially for large and complex datasets. However, for small or relatively simple datasets, it may result in unnecessary computational overhead. When fit_start is True, completing the first generation may take slightly longer (this increase in computational cost applies only to the first generation and does not affect subsequent generations). If fit_start is set to False, the initial population will be entirely random. Options: True or False. Default: True
122
122
 
123
123
  strategy (str, optional): Learning strategy. (options: 'accuracy', 'f1', 'precision', 'recall'): 'accuracy', Maximizes train (or test if given) accuracy during learning. 'f1', Maximizes train (or test if given) f1 score during learning. 'precision', Maximizes train (or test if given) precision score during learning. 'recall', Maximizes train (or test if given) recall during learning. Default is 'accuracy'.
124
124
 
@@ -210,15 +210,15 @@ def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=Non
210
210
 
211
211
  if fit_start is False or pop_size > activation_potentiation_len:
212
212
  weight_pop, act_pop = define_genomes(input_shape=len(x_train[0]), output_shape=len(y_train[0]), population_size=pop_size, dtype=dtype)
213
-
214
- if start_this_act is not None and start_this_W is not None:
215
- weight_pop[0] = start_this_W
216
- act_pop[0] = start_this_act
217
213
 
218
214
  else:
219
215
  weight_pop = [0] * pop_size
220
216
  act_pop = [0] * pop_size
221
217
 
218
+ if start_this_act is not None and start_this_W is not None:
219
+ weight_pop[0] = start_this_W
220
+ act_pop[0] = start_this_act
221
+
222
222
  for i in range(gen):
223
223
  postfix_dict["Gen"] = str(i+1) + '/' + str(gen)
224
224
  progress.set_postfix(postfix_dict)
@@ -235,9 +235,12 @@ def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=Non
235
235
  y_train_batch = cp.array(y_train_batch, dtype=dtype, copy=False)
236
236
 
237
237
  if fit_start is True and i == 0 and j < activation_potentiation_len:
238
- act_pop[j] = activation_potentiation[j]
239
- W = fit(x_train_batch, y_train_batch, activation_potentiation=act_pop[j], auto_normalization=auto_normalization, dtype=dtype)
240
- weight_pop[j] = W
238
+ if start_this_act is not None and j == 0:
239
+ pass
240
+ else:
241
+ act_pop[j] = activation_potentiation[j]
242
+ W = fit(x_train_batch, y_train_batch, activation_potentiation=act_pop[j], auto_normalization=auto_normalization, dtype=dtype)
243
+ weight_pop[j] = W
241
244
 
242
245
  model = evaluate(x_train_batch, y_train_batch, W=weight_pop[j], activation_potentiation=act_pop[j])
243
246
  acc = model[get_acc()]
@@ -319,7 +322,7 @@ def learner(x_train, y_train, optimizer, fit_start, strategy='accuracy', gen=Non
319
322
  # Check target accuracy
320
323
  if target_acc is not None and best_acc >= target_acc:
321
324
  progress.close()
322
- train_model = evaluate(x_train, y_train, W=best_weights, loading_bar_status=False,
325
+ train_model = evaluate(x_train, y_train, W=best_weights,
323
326
  activation_potentiation=final_activations)
324
327
 
325
328
  if loss == 'categorical_crossentropy':
pyerualjetwork/planeat.py CHANGED
@@ -424,7 +424,7 @@ def evaluate(x_population, weights, activation_potentiations):
424
424
  - The function returns a list of outputs after processing the population, where each element corresponds to
425
425
  the output for each genome in `x_population`.
426
426
  """
427
- ### THE OUTPUTS ARE RETURNED AS A PYTHON LIST, WHERE EACH GENOME'S OUTPUT MATCHES ITS INDEX:
427
+ ### THE OUTPUTS ARE RETURNED, WHERE EACH GENOME'S OUTPUT MATCHES ITS INDEX:
428
428
 
429
429
 
430
430
  if isinstance(activation_potentiations, str):
@@ -582,11 +582,20 @@ 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
- num_elements = int(len(dominant_parent_act) / threshold)
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]
586
591
 
587
- random_indices = [int(random.uniform(0, len(undominant_parent_act)-1)) for _ in range(num_elements)]
592
+ child_act.append(random_undominant_activation)
588
593
 
589
- child_act.extend([undominant_parent_act[i] for i in random_indices])
594
+ if len(dominant_parent_act) > new_threshold:
595
+ new_threshold += threshold
596
+
597
+ else:
598
+ break
590
599
 
591
600
  activation_selection_change_prob = 1 - activation_selection_change_prob
592
601
  potential_activation_selection_change_prob = random.uniform(0, 1)
@@ -594,12 +603,21 @@ def cross_over(first_parent_W,
594
603
  if potential_activation_selection_change_prob > activation_selection_change_prob:
595
604
 
596
605
  threshold = abs(activation_selection_threshold / succes)
597
- num_elements = min(len(dominant_parent_act), int(threshold))
598
-
599
- random_indices = random.choices(range(len(undominant_parent_act)), k=num_elements)
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]
600
613
 
601
- child_act.extend(undominant_parent_act[i] for i in random_indices)
614
+ child_act[random_index_dominant] = random_undominant_activation
602
615
 
616
+ if len(dominant_parent_act) > new_threshold:
617
+ new_threshold += threshold
618
+
619
+ else:
620
+ break
603
621
 
604
622
  return child_W, child_act
605
623
 
@@ -673,50 +691,80 @@ def mutation(weight,
673
691
  max_threshold = row_end * col_end
674
692
 
675
693
  threshold = weight_mutate_threshold * genome_fitness
676
- num_mutations = int(max_threshold / threshold)
677
-
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)
694
+ new_threshold = threshold
681
695
 
682
- weight[selected_rows, selected_cols] = new_values
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))
683
700
 
684
- activation_mutate_prob = 1 - activation_mutate_prob
685
- potential_activation_mutation = random.uniform(0, 1)
701
+ weight[selected_row, selected_col] = random.uniform(-1, 1)
702
+ new_threshold += threshold
686
703
 
687
- if potential_activation_mutation > activation_mutate_prob:
704
+ if max_threshold > new_threshold:
705
+ pass
688
706
 
689
- genome_fitness += epsilon
690
- threshold = abs(activation_mutate_threshold / genome_fitness)
691
- max_threshold = len(activations)
707
+ else:
708
+ break
692
709
 
693
- new_threshold = threshold
710
+ activation_mutate_prob = 1 - activation_mutate_prob
711
+ potential_activation_mutation = random.uniform(0, 1)
694
712
 
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
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)
701
718
 
702
- probabilities = [random.uniform(0, 1) for _ in range(max_threshold)]
703
- new_threshold = threshold
719
+ new_threshold = threshold
704
720
 
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))
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
723
+
724
+ activation_add_prob = 1 - activation_add_prob
725
+ activation_delete_prob = 1 - activation_delete_prob
726
+ activation_change_prob = 1 - activation_change_prob
710
727
 
711
- if p_add > activation_add_prob:
712
- activations.append(random.choice(all_acts))
728
+ for _ in range(max_threshold):
713
729
 
714
- if p_change > activation_change_prob:
715
- activations[random.randint(0, len(activations) - 1)] = random.choice(all_acts)
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)
716
733
 
717
- new_threshold += threshold
718
- if max_threshold <= new_threshold:
719
- break
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)
739
+
740
+
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:
749
+
750
+ activation = activations
751
+ activations = []
752
+
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))
761
+
762
+ activations[random_index_genom_act] = all_acts[random_index_all_act]
763
+
764
+ new_threshold += threshold
765
+
766
+ if max_threshold > new_threshold: pass
767
+ else: break
720
768
 
721
769
  return weight, activations
722
770
 
@@ -583,11 +583,21 @@ 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
- num_elements = int(len(dominant_parent_act) / threshold)
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]
587
592
 
588
- random_indices = [int(random.uniform(0, len(undominant_parent_act)-1)) for _ in range(num_elements)]
593
+ child_act.append(random_undominant_activation)
594
+ new_threshold += threshold
589
595
 
590
- child_act.extend([undominant_parent_act[i] for i in random_indices])
596
+ if len(dominant_parent_act) > new_threshold:
597
+ pass
598
+
599
+ else:
600
+ break
591
601
 
592
602
  activation_selection_change_prob = 1 - activation_selection_change_prob
593
603
  potential_activation_selection_change_prob = random.uniform(0, 1)
@@ -595,12 +605,22 @@ def cross_over(first_parent_W,
595
605
  if potential_activation_selection_change_prob > activation_selection_change_prob:
596
606
 
597
607
  threshold = abs(activation_selection_threshold / succes)
598
- num_elements = min(len(dominant_parent_act), int(threshold))
599
-
600
- random_indices = random.choices(range(len(undominant_parent_act)), k=num_elements)
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]
601
615
 
602
- child_act.extend(undominant_parent_act[i] for i in random_indices)
616
+ child_act[random_index_dominant] = random_undominant_activation
617
+ new_threshold += threshold
603
618
 
619
+ if len(dominant_parent_act) > new_threshold:
620
+ pass
621
+
622
+ else:
623
+ break
604
624
 
605
625
  return child_W, child_act
606
626
 
@@ -675,50 +695,79 @@ def mutation(weight,
675
695
  max_threshold = row_end * col_end
676
696
 
677
697
  threshold = weight_mutate_threshold * genome_fitness
678
- num_mutations = int(max_threshold / threshold)
698
+ new_threshold = threshold
679
699
 
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
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))
685
704
 
686
- activation_mutate_prob = 1 - activation_mutate_prob
687
- potential_activation_mutation = random.uniform(0, 1)
705
+ weight[selected_row, selected_col] = random.uniform(-1, 1)
706
+ new_threshold += threshold
688
707
 
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)
708
+ if max_threshold > new_threshold:
709
+ pass
710
+
711
+ else:
712
+ break
694
713
 
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
714
+ activation_mutate_prob = 1 - activation_mutate_prob
715
+ potential_activation_mutation = random.uniform(0, 1)
703
716
 
704
- probabilities = [random.uniform(0, 1) for _ in range(max_threshold)]
705
- new_threshold = threshold
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)
706
722
 
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))
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
712
731
 
713
- if p_add > activation_add_prob:
714
- activations.append(random.choice(all_acts))
732
+ for _ in range(max_threshold):
715
733
 
716
- if p_change > activation_change_prob:
717
- activations[random.randint(0, len(activations) - 1)] = random.choice(all_acts)
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)
718
737
 
719
- new_threshold += threshold
720
- if max_threshold <= new_threshold:
721
- break
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
+
744
+
745
+ if potential_activation_add_prob > activation_add_prob:
746
+
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])
751
+
752
+ except:
753
+
754
+ activation = activations
755
+ activations = []
756
+
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))
764
+
765
+ activations[random_index_genom_act] = all_acts[random_index_all_act]
766
+
767
+ new_threshold += threshold
768
+
769
+ if max_threshold > new_threshold: pass
770
+ else: break
722
771
 
723
772
  return weight, activations
724
773
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyerualjetwork
3
- Version: 4.3.9b5
3
+ Version: 4.3.9b7
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=TnfMF6gtFWhR_THUVWop8fLHqEWcVy-Y5orYzXPO7XQ,641
1
+ pyerualjetwork/__init__.py,sha256=9pV3ZfPPqMatL9LwixrmgVVhQ_rTYeIyrTAAutNbiuw,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
@@ -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=MCSCNYiiICRVZITobtS3ZIWmH5Q9gjyELuH32sAdgg4,12649
13
13
  pyerualjetwork/model_operations_cuda.py,sha256=NT01BK5nrDYE7H1x3KnSI8gmx0QTGGB0mP_LqEb1uuU,13157
14
- pyerualjetwork/plan.py,sha256=uK-7GRXqH0ETIajOW6_B6pSyktKmHg1NE4COD7z1f7E,23536
15
- pyerualjetwork/plan_cuda.py,sha256=tNez_xvK6yuUiwotopqtERAJUCc7RiLx7W8VEG7RoQY,24392
16
- pyerualjetwork/planeat.py,sha256=SeCbFebOlThMNTMX-acgVZswuztF22m_G2E4MRCSDs0,36231
17
- pyerualjetwork/planeat_cuda.py,sha256=XIDJwZAuQyzrBvFyQtbnfTUWRWDPGFmM3SfUXBa8foA,36233
14
+ pyerualjetwork/plan.py,sha256=mcVxwBus_GwfYjWLMwx8KDc25uJT8l773l-mHCfa0Xk,23558
15
+ pyerualjetwork/plan_cuda.py,sha256=8uEyYdQQX122Hcc-XfFoPSiCeLADt-y-cGX3AuRYPt0,24440
16
+ pyerualjetwork/planeat.py,sha256=OxwSjfSFPwh7kVrhnuAkr8Lrk73GB-Wk2ajUFIfZcbQ,37556
17
+ pyerualjetwork/planeat_cuda.py,sha256=aTdBmhJeIKC58pssODtqVsdOtJP7W6TRmVyGHp7k_CM,37612
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.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,,
21
+ pyerualjetwork-4.3.9b7.dist-info/METADATA,sha256=LaPTIsNcmnCw7sl_Q5PrEizpPa6aX236xs62-xnBOYw,7476
22
+ pyerualjetwork-4.3.9b7.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
23
+ pyerualjetwork-4.3.9b7.dist-info/top_level.txt,sha256=BRyt62U_r3ZmJpj-wXNOoA345Bzamrj6RbaWsyW4tRg,15
24
+ pyerualjetwork-4.3.9b7.dist-info/RECORD,,