pyerualjetwork 4.3.8.dev14__tar.gz → 4.3.8.dev15__tar.gz

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 (49) hide show
  1. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/PKG-INFO +1 -1
  2. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork/__init__.py +1 -1
  3. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork.egg-info/PKG-INFO +1 -1
  4. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork.egg-info/SOURCES.txt +1 -0
  5. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork_afterburner/__init__.py +1 -1
  6. pyerualjetwork-4.3.8.dev15/pyerualjetwork_afterburner/parallel.py +118 -0
  7. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork_afterburner/planeat_cuda.py +12 -100
  8. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/setup.py +1 -1
  9. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/README.md +0 -0
  10. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork/activation_functions.py +0 -0
  11. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork/activation_functions_cuda.py +0 -0
  12. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork/data_operations.py +0 -0
  13. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork/data_operations_cuda.py +0 -0
  14. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork/help.py +0 -0
  15. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork/loss_functions.py +0 -0
  16. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork/loss_functions_cuda.py +0 -0
  17. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork/memory_operations.py +0 -0
  18. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork/metrics.py +0 -0
  19. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork/metrics_cuda.py +0 -0
  20. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork/model_operations.py +0 -0
  21. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork/model_operations_cuda.py +0 -0
  22. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork/plan.py +0 -0
  23. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork/plan_cuda.py +0 -0
  24. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork/planeat.py +0 -0
  25. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork/planeat_cuda.py +0 -0
  26. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork/ui.py +0 -0
  27. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork/visualizations.py +0 -0
  28. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork/visualizations_cuda.py +0 -0
  29. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork.egg-info/dependency_links.txt +0 -0
  30. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork.egg-info/top_level.txt +0 -0
  31. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork_afterburner/activation_functions.py +0 -0
  32. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork_afterburner/activation_functions_cuda.py +0 -0
  33. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork_afterburner/data_operations.py +0 -0
  34. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork_afterburner/data_operations_cuda.py +0 -0
  35. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork_afterburner/help.py +0 -0
  36. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork_afterburner/loss_functions.py +0 -0
  37. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork_afterburner/loss_functions_cuda.py +0 -0
  38. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork_afterburner/memory_operations.py +0 -0
  39. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork_afterburner/metrics.py +0 -0
  40. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork_afterburner/metrics_cuda.py +0 -0
  41. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork_afterburner/model_operations.py +0 -0
  42. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork_afterburner/model_operations_cuda.py +0 -0
  43. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork_afterburner/plan.py +0 -0
  44. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork_afterburner/plan_cuda.py +0 -0
  45. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork_afterburner/planeat.py +0 -0
  46. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork_afterburner/ui.py +0 -0
  47. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork_afterburner/visualizations.py +0 -0
  48. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/pyerualjetwork_afterburner/visualizations_cuda.py +0 -0
  49. {pyerualjetwork-4.3.8.dev14 → pyerualjetwork-4.3.8.dev15}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyerualjetwork
3
- Version: 4.3.8.dev14
3
+ Version: 4.3.8.dev15
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
- __version__ = "4.3.8dev14"
1
+ __version__ = "4.3.8dev15"
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__):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyerualjetwork
3
- Version: 4.3.8.dev14
3
+ Version: 4.3.8.dev15
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
@@ -38,6 +38,7 @@ pyerualjetwork_afterburner/metrics.py
38
38
  pyerualjetwork_afterburner/metrics_cuda.py
39
39
  pyerualjetwork_afterburner/model_operations.py
40
40
  pyerualjetwork_afterburner/model_operations_cuda.py
41
+ pyerualjetwork_afterburner/parallel.py
41
42
  pyerualjetwork_afterburner/plan.py
42
43
  pyerualjetwork_afterburner/plan_cuda.py
43
44
  pyerualjetwork_afterburner/planeat.py
@@ -1,4 +1,4 @@
1
- __version__ = "4.3.8dev14-afterburner"
1
+ __version__ = "4.3.8dev15-afterburner"
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__):
@@ -0,0 +1,118 @@
1
+ import multiprocessing as mp
2
+ from functools import partial
3
+ import random
4
+ from .planeat import mutation, cross_over, second_parent_selection
5
+
6
+ def run_process(policy, best_weight, best_activations, good_weights,
7
+ good_activations, bad_weights, bad_activations, best_fitness,
8
+ normalized_fitness, child_W, child_act, mutated_W, mutated_act,
9
+ cross_over_mode, activation_selection_add_prob,
10
+ activation_selection_change_prob, activation_selection_threshold,
11
+ bad_genomes_selection_prob, fitness_bias, epsilon,
12
+ bad_genomes_mutation_prob, activation_mutate_prob,
13
+ activation_mutate_add_prob, activation_mutate_delete_prob,
14
+ activation_mutate_change_prob, weight_mutate_prob,
15
+ weight_mutate_threshold, activation_mutate_threshold):
16
+
17
+ process_func = partial(process_single, policy=policy, best_weight=best_weight,
18
+ best_activations=best_activations, good_weights=good_weights,
19
+ good_activations=good_activations, bad_weights=bad_weights,
20
+ bad_activations=bad_activations, best_fitness=best_fitness,
21
+ normalized_fitness=normalized_fitness, child_W=child_W,
22
+ child_act=child_act, mutated_W=mutated_W, mutated_act=mutated_act,
23
+ cross_over_mode=cross_over_mode,
24
+ activation_selection_add_prob=activation_selection_add_prob,
25
+ activation_selection_change_prob=activation_selection_change_prob,
26
+ activation_selection_threshold=activation_selection_threshold,
27
+ bad_genomes_selection_prob=bad_genomes_selection_prob,
28
+ fitness_bias=fitness_bias,
29
+ epsilon=epsilon,
30
+ bad_genomes_mutation_prob=bad_genomes_mutation_prob,
31
+ activation_mutate_prob=activation_mutate_prob,
32
+ activation_mutate_add_prob=activation_mutate_add_prob,
33
+ activation_mutate_delete_prob=activation_mutate_delete_prob,
34
+ activation_mutate_change_prob=activation_mutate_change_prob,
35
+ weight_mutate_prob=weight_mutate_prob,
36
+ weight_mutate_threshold=weight_mutate_threshold,
37
+ activation_mutate_threshold=activation_mutate_threshold)
38
+
39
+ with mp.Pool() as pool:
40
+ results = pool.map(process_func, range(len(bad_weights)))
41
+
42
+ for i, new_child_W, new_child_act, new_mutated_W, new_mutated_act in results:
43
+ child_W[i] = new_child_W
44
+ child_act[i] = new_child_act
45
+ mutated_W[i] = new_mutated_W
46
+ mutated_act[i] = new_mutated_act
47
+
48
+
49
+ return child_W, child_act, mutated_W, mutated_act
50
+
51
+
52
+ def process_single(i, policy, best_weight, best_activations,
53
+ good_weights, good_activations,
54
+ bad_weights, bad_activations,
55
+ best_fitness, normalized_fitness,
56
+ cross_over_mode,
57
+ activation_selection_add_prob, activation_selection_change_prob,
58
+ activation_selection_threshold,
59
+ bad_genomes_selection_prob, fitness_bias,
60
+ epsilon, bad_genomes_mutation_prob,
61
+ activation_mutate_prob, activation_mutate_add_prob,
62
+ activation_mutate_delete_prob, activation_mutate_change_prob,
63
+ weight_mutate_prob, weight_mutate_threshold,
64
+ activation_mutate_threshold):
65
+
66
+ if policy == 'aggressive':
67
+ first_parent_W = best_weight
68
+ first_parent_act = best_activations
69
+ elif policy == 'explorer':
70
+ first_parent_W = good_weights[i]
71
+ first_parent_act = good_activations[i]
72
+ else:
73
+ raise ValueError("policy parameter must be: 'aggressive' or 'explorer'")
74
+
75
+ second_parent_W, second_parent_act, s_i = second_parent_selection(
76
+ good_weights, bad_weights, good_activations, bad_activations, bad_genomes_selection_prob)
77
+
78
+ new_child_W, new_child_act = cross_over(
79
+ first_parent_W,
80
+ second_parent_W,
81
+ first_parent_act,
82
+ second_parent_act,
83
+ cross_over_mode=cross_over_mode,
84
+ activation_selection_add_prob=activation_selection_add_prob,
85
+ activation_selection_change_prob=activation_selection_change_prob,
86
+ activation_selection_threshold=activation_selection_threshold,
87
+ bad_genomes_selection_prob=bad_genomes_selection_prob,
88
+ first_parent_fitness=best_fitness,
89
+ fitness_bias=fitness_bias,
90
+ second_parent_fitness=normalized_fitness[s_i],
91
+ epsilon=epsilon
92
+ )
93
+
94
+ mutation_prob = random.uniform(0, 1)
95
+ if mutation_prob > bad_genomes_mutation_prob:
96
+ genome_W = good_weights[i]
97
+ genome_act = good_activations[i]
98
+ fitness_index = int(len(bad_weights) / 2 + i)
99
+ else:
100
+ genome_W = bad_weights[i]
101
+ genome_act = bad_activations[i]
102
+ fitness_index = i
103
+
104
+ new_mutated_W, new_mutated_act = mutation(
105
+ genome_W,
106
+ genome_act,
107
+ activation_mutate_prob=activation_mutate_prob,
108
+ activation_add_prob=activation_mutate_add_prob,
109
+ activation_delete_prob=activation_mutate_delete_prob,
110
+ activation_change_prob=activation_mutate_change_prob,
111
+ weight_mutate_prob=weight_mutate_prob,
112
+ weight_mutate_threshold=weight_mutate_threshold,
113
+ genome_fitness=normalized_fitness[fitness_index],
114
+ activation_mutate_threshold=activation_mutate_threshold,
115
+ epsilon=epsilon
116
+ )
117
+
118
+ return (i, new_child_W, new_child_act, new_mutated_W, new_mutated_act)
@@ -221,6 +221,8 @@ def evolver(weights,
221
221
  - The function returns the updated weights and activations after processing based on the chosen strategy, policy, and mutation parameters.
222
222
  """
223
223
 
224
+ from .parallel import run_process
225
+
224
226
  ### ERROR AND CONFIGURATION CHECKS:
225
227
  if strategy == 'normal_selective':
226
228
  if bad_genomes_mutation_prob is None: bad_genomes_mutation_prob = 0.7 # EFFECTS MUTATION
@@ -294,39 +296,18 @@ def evolver(weights,
294
296
 
295
297
  mutated_W = cp.copy(bad_weights)
296
298
  mutated_act = bad_activations.copy()
297
-
298
- mp.set_start_method("spawn", force=True)
299
299
 
300
- process_func = partial(process_single, policy=policy, best_weight=best_weight,
301
- best_activations=best_activations, good_weights=good_weights,
302
- good_activations=good_activations, bad_weights=bad_weights,
303
- bad_activations=bad_activations, best_fitness=best_fitness,
304
- normalized_fitness=normalized_fitness, child_W=child_W,
305
- child_act=child_act, mutated_W=mutated_W, mutated_act=mutated_act,
306
- cross_over_mode=cross_over_mode,
307
- activation_selection_add_prob=activation_selection_add_prob,
308
- activation_selection_change_prob=activation_selection_change_prob,
309
- activation_selection_threshold=activation_selection_threshold,
310
- bad_genomes_selection_prob=bad_genomes_selection_prob,
311
- fitness_bias=fitness_bias,
312
- epsilon=epsilon,
313
- bad_genomes_mutation_prob=bad_genomes_mutation_prob,
314
- activation_mutate_prob=activation_mutate_prob,
315
- activation_mutate_add_prob=activation_mutate_add_prob,
316
- activation_mutate_delete_prob=activation_mutate_delete_prob,
317
- activation_mutate_change_prob=activation_mutate_change_prob,
318
- weight_mutate_prob=weight_mutate_prob,
319
- weight_mutate_threshold=weight_mutate_threshold,
320
- activation_mutate_threshold=activation_mutate_threshold)
300
+ child_W, child_act, mutated_W, mutated_act = run_process(policy, best_weight, best_activations, good_weights,
301
+ good_activations, bad_weights, bad_activations, best_fitness,
302
+ normalized_fitness, child_W, child_act, mutated_W, mutated_act,
303
+ cross_over_mode, activation_selection_add_prob,
304
+ activation_selection_change_prob, activation_selection_threshold,
305
+ bad_genomes_selection_prob, fitness_bias, epsilon,
306
+ bad_genomes_mutation_prob, activation_mutate_prob,
307
+ activation_mutate_add_prob, activation_mutate_delete_prob,
308
+ activation_mutate_change_prob, weight_mutate_prob,
309
+ weight_mutate_threshold, activation_mutate_threshold)
321
310
 
322
- with mp.Pool() as pool:
323
- results = pool.map(process_func, range(len(bad_weights)))
324
-
325
- for i, new_child_W, new_child_act, new_mutated_W, new_mutated_act in results:
326
- child_W[i] = new_child_W
327
- child_act[i] = new_child_act
328
- mutated_W[i] = new_mutated_W
329
- mutated_act[i] = new_mutated_act
330
311
 
331
312
  child_W[0] = best_weight
332
313
  child_act[0] = best_activations
@@ -371,75 +352,6 @@ def evolver(weights,
371
352
  return weights, activation_potentiations
372
353
 
373
354
 
374
- def process_single(i, policy, best_weight, best_activations,
375
- good_weights, good_activations,
376
- bad_weights, bad_activations,
377
- best_fitness, normalized_fitness,
378
- cross_over_mode,
379
- activation_selection_add_prob, activation_selection_change_prob,
380
- activation_selection_threshold,
381
- bad_genomes_selection_prob, fitness_bias,
382
- epsilon, bad_genomes_mutation_prob,
383
- activation_mutate_prob, activation_mutate_add_prob,
384
- activation_mutate_delete_prob, activation_mutate_change_prob,
385
- weight_mutate_prob, weight_mutate_threshold,
386
- activation_mutate_threshold):
387
-
388
- if policy == 'aggressive':
389
- first_parent_W = best_weight
390
- first_parent_act = best_activations
391
- elif policy == 'explorer':
392
- first_parent_W = good_weights[i]
393
- first_parent_act = good_activations[i]
394
- else:
395
- raise ValueError("policy parameter must be: 'aggressive' or 'explorer'")
396
-
397
- second_parent_W, second_parent_act, s_i = second_parent_selection(
398
- good_weights, bad_weights, good_activations, bad_activations, bad_genomes_selection_prob)
399
-
400
- new_child_W, new_child_act = cross_over(
401
- first_parent_W,
402
- second_parent_W,
403
- first_parent_act,
404
- second_parent_act,
405
- cross_over_mode=cross_over_mode,
406
- activation_selection_add_prob=activation_selection_add_prob,
407
- activation_selection_change_prob=activation_selection_change_prob,
408
- activation_selection_threshold=activation_selection_threshold,
409
- bad_genomes_selection_prob=bad_genomes_selection_prob,
410
- first_parent_fitness=best_fitness,
411
- fitness_bias=fitness_bias,
412
- second_parent_fitness=normalized_fitness[s_i],
413
- epsilon=epsilon
414
- )
415
-
416
- mutation_prob = random.uniform(0, 1)
417
- if mutation_prob > bad_genomes_mutation_prob:
418
- genome_W = good_weights[i]
419
- genome_act = good_activations[i]
420
- fitness_index = int(len(bad_weights) / 2 + i)
421
- else:
422
- genome_W = bad_weights[i]
423
- genome_act = bad_activations[i]
424
- fitness_index = i
425
-
426
- new_mutated_W, new_mutated_act = mutation(
427
- genome_W,
428
- genome_act,
429
- activation_mutate_prob=activation_mutate_prob,
430
- activation_add_prob=activation_mutate_add_prob,
431
- activation_delete_prob=activation_mutate_delete_prob,
432
- activation_change_prob=activation_mutate_change_prob,
433
- weight_mutate_prob=weight_mutate_prob,
434
- weight_mutate_threshold=weight_mutate_threshold,
435
- genome_fitness=normalized_fitness[fitness_index],
436
- activation_mutate_threshold=activation_mutate_threshold,
437
- epsilon=epsilon
438
- )
439
-
440
- return (i, new_child_W, new_child_act, new_mutated_W, new_mutated_act)
441
-
442
-
443
355
  def evaluate(x_population, weights, activation_potentiations):
444
356
  """
445
357
  Evaluates the performance of a population of genomes, applying different activation functions
@@ -6,7 +6,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
6
6
  # Setting Up
7
7
  setup(
8
8
  name="pyerualjetwork",
9
- version="4.3.8dev14",
9
+ version="4.3.8dev15",
10
10
  author="Hasan Can Beydili",
11
11
  author_email="tchasancan@gmail.com",
12
12
  description=(