pyerualjetwork 4.3.8.dev13__py3-none-any.whl → 4.3.8.dev15__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.
- pyerualjetwork/__init__.py +1 -1
- {pyerualjetwork-4.3.8.dev13.dist-info → pyerualjetwork-4.3.8.dev15.dist-info}/METADATA +1 -1
- {pyerualjetwork-4.3.8.dev13.dist-info → pyerualjetwork-4.3.8.dev15.dist-info}/RECORD +8 -7
- pyerualjetwork_afterburner/__init__.py +1 -1
- pyerualjetwork_afterburner/parallel.py +118 -0
- pyerualjetwork_afterburner/planeat_cuda.py +13 -101
- {pyerualjetwork-4.3.8.dev13.dist-info → pyerualjetwork-4.3.8.dev15.dist-info}/WHEEL +0 -0
- {pyerualjetwork-4.3.8.dev13.dist-info → pyerualjetwork-4.3.8.dev15.dist-info}/top_level.txt +0 -0
pyerualjetwork/__init__.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
__version__ = "4.3.
|
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.
|
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
|
-
pyerualjetwork/__init__.py,sha256=
|
1
|
+
pyerualjetwork/__init__.py,sha256=nExIY8tR-NFtscBgb0Qnv8sKakbbE2V5SL2nES0aZTI,644
|
2
2
|
pyerualjetwork/activation_functions.py,sha256=AR91fQV2W2rc-Qb4Yp7b8ucYpGjwyQUewO-M-lyEMs8,7729
|
3
3
|
pyerualjetwork/activation_functions_cuda.py,sha256=ztIw6rMR4t1289_TPIGYwE6qarl_YbSOGj5Ep3rUMqs,11803
|
4
4
|
pyerualjetwork/data_operations.py,sha256=Flteouu6rfSo2uHMqBHuzO02dXmbNa-I5qWmUpGTZ5Y,14760
|
@@ -18,7 +18,7 @@ pyerualjetwork/planeat_cuda.py,sha256=QNHCQLkR0MNFqyN2iHAtC7cbf8qZiD3p_54YH3lnMF
|
|
18
18
|
pyerualjetwork/ui.py,sha256=wu2BhU1k-w3Kcho5Jtq4SEKe68ftaUeRGneUOSCVDjU,575
|
19
19
|
pyerualjetwork/visualizations.py,sha256=VL00sX2DZz83F__PyEJH9s1LizuXpOBzWjnoSjMJIJ0,28770
|
20
20
|
pyerualjetwork/visualizations_cuda.py,sha256=KbMhfsLlxujy_i3QrwCf734Q-k6d7Zn_7CEbm3gzK9w,29186
|
21
|
-
pyerualjetwork_afterburner/__init__.py,sha256=
|
21
|
+
pyerualjetwork_afterburner/__init__.py,sha256=A5YqLtQ9TUhfBHlkSSpTb6pMtkk0FJQOUwAIJu0LMIc,656
|
22
22
|
pyerualjetwork_afterburner/activation_functions.py,sha256=bKf00lsuuLJNO-4vVp4OqBi4zJ-qZ8L3v-vl52notkY,7721
|
23
23
|
pyerualjetwork_afterburner/activation_functions_cuda.py,sha256=5y1Ti3GDfDteQDCUmODwe7tAyDAUlDTKmIikChQ8d6g,7772
|
24
24
|
pyerualjetwork_afterburner/data_operations.py,sha256=Flteouu6rfSo2uHMqBHuzO02dXmbNa-I5qWmUpGTZ5Y,14760
|
@@ -31,14 +31,15 @@ pyerualjetwork_afterburner/metrics.py,sha256=q7MkhnZDRbCjFBDDfUgrl8lBYnUT_1ro1Lx
|
|
31
31
|
pyerualjetwork_afterburner/metrics_cuda.py,sha256=73h9GC7XwmnFCVzFEEiPQfF8CwHIz2wsCbxpZrJtYgw,5061
|
32
32
|
pyerualjetwork_afterburner/model_operations.py,sha256=MCSCNYiiICRVZITobtS3ZIWmH5Q9gjyELuH32sAdgg4,12649
|
33
33
|
pyerualjetwork_afterburner/model_operations_cuda.py,sha256=NT01BK5nrDYE7H1x3KnSI8gmx0QTGGB0mP_LqEb1uuU,13157
|
34
|
+
pyerualjetwork_afterburner/parallel.py,sha256=TqTSqyxnq7lA9IYE-lCxqUO_GVdAYL34n4K67CMSNKI,5946
|
34
35
|
pyerualjetwork_afterburner/plan.py,sha256=EOXngujG7DQRf3cooFigKB7heQsEoK96JtrcKivT_pE,22449
|
35
36
|
pyerualjetwork_afterburner/plan_cuda.py,sha256=fg5YunEuBE7sK6q9paP_yAGONr9x0e19oF0J0DucejM,23380
|
36
37
|
pyerualjetwork_afterburner/planeat.py,sha256=Lq5R0aMS4UIdZdbUKsKDv5g0WLwYryomR3IQYb8vAa4,37573
|
37
|
-
pyerualjetwork_afterburner/planeat_cuda.py,sha256=
|
38
|
+
pyerualjetwork_afterburner/planeat_cuda.py,sha256=icjtJcZnA1DcE93mKpdQOp5nMGSqycTbLOym7yITXwY,35299
|
38
39
|
pyerualjetwork_afterburner/ui.py,sha256=wu2BhU1k-w3Kcho5Jtq4SEKe68ftaUeRGneUOSCVDjU,575
|
39
40
|
pyerualjetwork_afterburner/visualizations.py,sha256=1SKMZaJ80OD2qHUyMxW1IOv8zwmxzMPxclfbeq1Xr4g,28772
|
40
41
|
pyerualjetwork_afterburner/visualizations_cuda.py,sha256=KbMhfsLlxujy_i3QrwCf734Q-k6d7Zn_7CEbm3gzK9w,29186
|
41
|
-
pyerualjetwork-4.3.8.
|
42
|
-
pyerualjetwork-4.3.8.
|
43
|
-
pyerualjetwork-4.3.8.
|
44
|
-
pyerualjetwork-4.3.8.
|
42
|
+
pyerualjetwork-4.3.8.dev15.dist-info/METADATA,sha256=6YSlEsLUfwZz6a3hxScGBeRZj5M2WIZbrPPh6BA-dNA,8385
|
43
|
+
pyerualjetwork-4.3.8.dev15.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
44
|
+
pyerualjetwork-4.3.8.dev15.dist-info/top_level.txt,sha256=uK64ge08QQoPuXM3aiRVPgiQQtl8Fxm2-HieIut5Lwo,42
|
45
|
+
pyerualjetwork-4.3.8.dev15.dist-info/RECORD,,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
__version__ = "4.3.
|
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
|
-
process_func = partial(process_single, policy=policy, best_weight=best_weight,
|
299
|
-
best_activations=best_activations, good_weights=good_weights,
|
300
|
-
good_activations=good_activations, bad_weights=bad_weights,
|
301
|
-
bad_activations=bad_activations, best_fitness=best_fitness,
|
302
|
-
normalized_fitness=normalized_fitness, child_W=child_W,
|
303
|
-
child_act=child_act, mutated_W=mutated_W, mutated_act=mutated_act,
|
304
|
-
cross_over_mode=cross_over_mode,
|
305
|
-
activation_selection_add_prob=activation_selection_add_prob,
|
306
|
-
activation_selection_change_prob=activation_selection_change_prob,
|
307
|
-
activation_selection_threshold=activation_selection_threshold,
|
308
|
-
bad_genomes_selection_prob=bad_genomes_selection_prob,
|
309
|
-
fitness_bias=fitness_bias,
|
310
|
-
epsilon=epsilon,
|
311
|
-
bad_genomes_mutation_prob=bad_genomes_mutation_prob,
|
312
|
-
activation_mutate_prob=activation_mutate_prob,
|
313
|
-
activation_mutate_add_prob=activation_mutate_add_prob,
|
314
|
-
activation_mutate_delete_prob=activation_mutate_delete_prob,
|
315
|
-
activation_mutate_change_prob=activation_mutate_change_prob,
|
316
|
-
weight_mutate_prob=weight_mutate_prob,
|
317
|
-
weight_mutate_threshold=weight_mutate_threshold,
|
318
|
-
activation_mutate_threshold=activation_mutate_threshold)
|
319
299
|
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
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)
|
310
|
+
|
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
|
File without changes
|
File without changes
|