pyerualjetwork 4.2.0b3__py3-none-any.whl → 4.2.0b4__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/planeat.py +34 -36
- pyerualjetwork/planeat_cuda.py +33 -35
- {pyerualjetwork-4.2.0b3.dist-info → pyerualjetwork-4.2.0b4.dist-info}/METADATA +1 -1
- {pyerualjetwork-4.2.0b3.dist-info → pyerualjetwork-4.2.0b4.dist-info}/RECORD +7 -7
- {pyerualjetwork-4.2.0b3.dist-info → pyerualjetwork-4.2.0b4.dist-info}/WHEEL +0 -0
- {pyerualjetwork-4.2.0b3.dist-info → pyerualjetwork-4.2.0b4.dist-info}/top_level.txt +0 -0
pyerualjetwork/__init__.py
CHANGED
@@ -48,7 +48,7 @@ for package_name in package_names:
|
|
48
48
|
|
49
49
|
print(f"PyerualJetwork is ready to use with {err} errors")
|
50
50
|
|
51
|
-
__version__ = "4.2.
|
51
|
+
__version__ = "4.2.0b4"
|
52
52
|
__update__ = "* Changes: https://github.com/HCB06/PyerualJetwork/blob/main/CHANGES\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"
|
53
53
|
|
54
54
|
def print_version(__version__):
|
pyerualjetwork/planeat.py
CHANGED
@@ -290,7 +290,7 @@ def evolver(weights,
|
|
290
290
|
|
291
291
|
good_weights = weights[slice_center:]
|
292
292
|
bad_weights = weights[:slice_center]
|
293
|
-
|
293
|
+
best_weight = good_weights[-1]
|
294
294
|
|
295
295
|
good_activations = list(activation_potentiations[slice_center:])
|
296
296
|
bad_activations = list(activation_potentiations[:slice_center])
|
@@ -307,47 +307,45 @@ def evolver(weights,
|
|
307
307
|
best_fitness = normalized_fitness[-1]
|
308
308
|
epsilon = np.finfo(float).eps
|
309
309
|
|
310
|
-
|
311
|
-
|
310
|
+
child_W = np.empty(bad_weights[0].shape, dtype=dtype)
|
311
|
+
child_act = bad_activations.copy()
|
312
312
|
|
313
|
+
for i in range(len(bad_weights)):
|
314
|
+
|
313
315
|
if policy == 'aggresive':
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
second_parent_act,
|
318
|
-
cross_over_mode=cross_over_mode,
|
319
|
-
activation_selection_add_prob=activation_selection_add_prob,
|
320
|
-
activation_selection_change_prob=activation_selection_change_prob,
|
321
|
-
activation_selection_rate=activation_selection_rate,
|
322
|
-
bad_genomes_selection_prob=bad_genomes_selection_prob,
|
323
|
-
first_parent_fitness=best_fitness,
|
324
|
-
fitness_bias=fitness_bias,
|
325
|
-
second_parent_fitness=normalized_fitness[s_i],
|
326
|
-
epsilon=epsilon
|
327
|
-
)
|
316
|
+
first_parent_W = best_weight
|
317
|
+
first_parent_act = best_activations
|
318
|
+
|
328
319
|
elif policy == 'explorer':
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
second_parent_act,
|
333
|
-
cross_over_mode=cross_over_mode,
|
334
|
-
activation_selection_add_prob=activation_selection_add_prob,
|
335
|
-
activation_selection_change_prob=activation_selection_change_prob,
|
336
|
-
activation_selection_rate=activation_selection_rate,
|
337
|
-
bad_genomes_selection_prob=bad_genomes_selection_prob,
|
338
|
-
first_parent_fitness=normalized_fitness[i],
|
339
|
-
fitness_bias=fitness_bias,
|
340
|
-
second_parent_fitness=normalized_fitness[s_i],
|
341
|
-
epsilon=epsilon
|
342
|
-
)
|
343
|
-
|
320
|
+
first_parent_W = good_weights[i]
|
321
|
+
first_parent_act = good_activations[i]
|
322
|
+
|
344
323
|
else: raise ValueError("policy parameter must be: 'aggresive' or 'explorer'")
|
324
|
+
|
325
|
+
second_parent_W, second_parent_act, s_i = second_parent_selection(good_weights, bad_weights, good_activations, bad_activations, bad_genomes_selection_prob)
|
326
|
+
|
327
|
+
child_W[i], child_act[i] = cross_over(first_parent_W,
|
328
|
+
second_parent_W,
|
329
|
+
first_parent_act,
|
330
|
+
second_parent_act,
|
331
|
+
cross_over_mode=cross_over_mode,
|
332
|
+
activation_selection_add_prob=activation_selection_add_prob,
|
333
|
+
activation_selection_change_prob=activation_selection_change_prob,
|
334
|
+
activation_selection_rate=activation_selection_rate,
|
335
|
+
bad_genomes_selection_prob=bad_genomes_selection_prob,
|
336
|
+
first_parent_fitness=best_fitness,
|
337
|
+
fitness_bias=fitness_bias,
|
338
|
+
second_parent_fitness=normalized_fitness[s_i],
|
339
|
+
epsilon=epsilon
|
340
|
+
)
|
341
|
+
|
345
342
|
|
346
343
|
if mutations is True:
|
347
344
|
mutation_prob = random.uniform(0, 1)
|
348
345
|
|
349
346
|
if mutation_prob > bad_genomes_mutation_prob:
|
350
|
-
if (save_best_genom == True and not np.array_equal(good_weights[i],
|
347
|
+
if (save_best_genom == True and not np.array_equal(good_weights[i], best_weight)) or save_best_genom == False:
|
348
|
+
|
351
349
|
good_weights[i], good_activations[i] = mutation(good_weights[i],
|
352
350
|
good_activations[i],
|
353
351
|
activation_mutate_prob=activation_mutate_prob,
|
@@ -375,8 +373,8 @@ def evolver(weights,
|
|
375
373
|
|
376
374
|
if bar_status: progress.update(1)
|
377
375
|
|
378
|
-
weights = np.vstack((
|
379
|
-
activation_potentiations =
|
376
|
+
weights = np.vstack((child_W, good_weights))
|
377
|
+
activation_potentiations = child_act + good_activations
|
380
378
|
|
381
379
|
### INFO PRINTING CONSOLE
|
382
380
|
|
@@ -706,7 +704,7 @@ def mutation(weight,
|
|
706
704
|
genome_fitness (float): Fitness value of genome
|
707
705
|
|
708
706
|
epsilon (float): Small epsilon constant
|
709
|
-
|
707
|
+
|
710
708
|
Returns:
|
711
709
|
tuple: A tuple containing:
|
712
710
|
- mutated_weight (numpy.ndarray): The weight matrix after mutation.
|
pyerualjetwork/planeat_cuda.py
CHANGED
@@ -290,7 +290,7 @@ def evolver(weights,
|
|
290
290
|
|
291
291
|
good_weights = weights[slice_center:]
|
292
292
|
bad_weights = weights[:slice_center]
|
293
|
-
|
293
|
+
best_weight = good_weights[-1]
|
294
294
|
|
295
295
|
good_activations = list(activation_potentiations[slice_center:])
|
296
296
|
bad_activations = list(activation_potentiations[:slice_center])
|
@@ -306,48 +306,46 @@ def evolver(weights,
|
|
306
306
|
|
307
307
|
best_fitness = normalized_fitness[-1]
|
308
308
|
epsilon = cp.finfo(float).eps
|
309
|
+
|
310
|
+
child_W = cp.empty(bad_weights[0].shape, dtype=dtype)
|
311
|
+
child_act = bad_activations.copy()
|
309
312
|
|
310
313
|
for i in range(len(bad_weights)):
|
311
|
-
|
312
|
-
|
314
|
+
|
313
315
|
if policy == 'aggresive':
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
second_parent_act,
|
318
|
-
cross_over_mode=cross_over_mode,
|
319
|
-
activation_selection_add_prob=activation_selection_add_prob,
|
320
|
-
activation_selection_change_prob=activation_selection_change_prob,
|
321
|
-
activation_selection_rate=activation_selection_rate,
|
322
|
-
bad_genomes_selection_prob=bad_genomes_selection_prob,
|
323
|
-
first_parent_fitness=best_fitness,
|
324
|
-
fitness_bias=fitness_bias,
|
325
|
-
second_parent_fitness=normalized_fitness[s_i],
|
326
|
-
epsilon=epsilon
|
327
|
-
)
|
316
|
+
first_parent_W = best_weight
|
317
|
+
first_parent_act = best_activations
|
318
|
+
|
328
319
|
elif policy == 'explorer':
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
second_parent_act,
|
333
|
-
cross_over_mode=cross_over_mode,
|
334
|
-
activation_selection_add_prob=activation_selection_add_prob,
|
335
|
-
activation_selection_change_prob=activation_selection_change_prob,
|
336
|
-
activation_selection_rate=activation_selection_rate,
|
337
|
-
bad_genomes_selection_prob=bad_genomes_selection_prob,
|
338
|
-
first_parent_fitness=normalized_fitness[i],
|
339
|
-
fitness_bias=fitness_bias,
|
340
|
-
second_parent_fitness=normalized_fitness[s_i],
|
341
|
-
epsilon=epsilon
|
342
|
-
)
|
343
|
-
|
320
|
+
first_parent_W = good_weights[i]
|
321
|
+
first_parent_act = good_activations[i]
|
322
|
+
|
344
323
|
else: raise ValueError("policy parameter must be: 'aggresive' or 'explorer'")
|
324
|
+
|
325
|
+
second_parent_W, second_parent_act, s_i = second_parent_selection(good_weights, bad_weights, good_activations, bad_activations, bad_genomes_selection_prob)
|
326
|
+
|
327
|
+
child_W[i], child_act[i] = cross_over(first_parent_W,
|
328
|
+
second_parent_W,
|
329
|
+
first_parent_act,
|
330
|
+
second_parent_act,
|
331
|
+
cross_over_mode=cross_over_mode,
|
332
|
+
activation_selection_add_prob=activation_selection_add_prob,
|
333
|
+
activation_selection_change_prob=activation_selection_change_prob,
|
334
|
+
activation_selection_rate=activation_selection_rate,
|
335
|
+
bad_genomes_selection_prob=bad_genomes_selection_prob,
|
336
|
+
first_parent_fitness=best_fitness,
|
337
|
+
fitness_bias=fitness_bias,
|
338
|
+
second_parent_fitness=normalized_fitness[s_i],
|
339
|
+
epsilon=epsilon
|
340
|
+
)
|
341
|
+
|
345
342
|
|
346
343
|
if mutations is True:
|
347
344
|
mutation_prob = random.uniform(0, 1)
|
348
345
|
|
349
346
|
if mutation_prob > bad_genomes_mutation_prob:
|
350
|
-
if (save_best_genom == True and not np.array_equal(good_weights[i],
|
347
|
+
if (save_best_genom == True and not np.array_equal(good_weights[i], best_weight)) or save_best_genom == False:
|
348
|
+
|
351
349
|
good_weights[i], good_activations[i] = mutation(good_weights[i],
|
352
350
|
good_activations[i],
|
353
351
|
activation_mutate_prob=activation_mutate_prob,
|
@@ -375,8 +373,8 @@ def evolver(weights,
|
|
375
373
|
|
376
374
|
if bar_status: progress.update(1)
|
377
375
|
|
378
|
-
weights = cp.vstack((
|
379
|
-
activation_potentiations =
|
376
|
+
weights = cp.vstack((child_W, good_weights))
|
377
|
+
activation_potentiations = child_act + good_activations
|
380
378
|
|
381
379
|
### INFO PRINTING CONSOLE
|
382
380
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pyerualjetwork
|
3
|
-
Version: 4.2.
|
3
|
+
Version: 4.2.0b4
|
4
4
|
Summary: PyerualJetwork is a machine learning library written in Python for professionals, incorporating advanced, unique, new, and modern techniques.
|
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=VRFLz0qjl7ZNj1nm6TFjuEit1_lEp-qO6GuBhakW_wA,2177
|
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=HjyW2QE18age6J8iG0jpbwqGOylL_nM-vE2CLbP9Wes,14690
|
@@ -13,12 +13,12 @@ pyerualjetwork/model_operations.py,sha256=hnhR8dtoICNJWIwGgJ65-LN3GYN_DYH4LMe6Yp
|
|
13
13
|
pyerualjetwork/model_operations_cuda.py,sha256=XnKKq54ZLaqCm-NaJ6d8IToACKcKg2Ttq6moowVRRWo,13365
|
14
14
|
pyerualjetwork/plan.py,sha256=EobwajGSIgbOujkzDKb-Kea0LGRHqpK3Xy1Le8VBAe8,34422
|
15
15
|
pyerualjetwork/plan_cuda.py,sha256=iCcAHLzVw_VyjhkFHXzBWiedwbnpI1MCXNJgSDgZxWw,36065
|
16
|
-
pyerualjetwork/planeat.py,sha256=
|
17
|
-
pyerualjetwork/planeat_cuda.py,sha256=
|
16
|
+
pyerualjetwork/planeat.py,sha256=Lr79cXaHsTYkLEA9zrrI0mIdLDy5l5Qa0_tlkqugxGE,41071
|
17
|
+
pyerualjetwork/planeat_cuda.py,sha256=qHwISR1JOaTYklBKf59BQ-ixPDlludk61dJMrp-wNi0,41038
|
18
18
|
pyerualjetwork/ui.py,sha256=wu2BhU1k-w3Kcho5Jtq4SEKe68ftaUeRGneUOSCVDjU,575
|
19
19
|
pyerualjetwork/visualizations.py,sha256=QaYSIyVkJZ8NqpBKArQKkI1y37nCQo_KIM98IMssnRc,28766
|
20
20
|
pyerualjetwork/visualizations_cuda.py,sha256=F60vQ92AXlMgBka3InXnOtGoM25vQJAlBIU2AlYTwks,29200
|
21
|
-
pyerualjetwork-4.2.
|
22
|
-
pyerualjetwork-4.2.
|
23
|
-
pyerualjetwork-4.2.
|
24
|
-
pyerualjetwork-4.2.
|
21
|
+
pyerualjetwork-4.2.0b4.dist-info/METADATA,sha256=B8Katp20szrJ7XPZSy4YfVNsdJSLUJsepiZ5dasYDww,7795
|
22
|
+
pyerualjetwork-4.2.0b4.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
23
|
+
pyerualjetwork-4.2.0b4.dist-info/top_level.txt,sha256=BRyt62U_r3ZmJpj-wXNOoA345Bzamrj6RbaWsyW4tRg,15
|
24
|
+
pyerualjetwork-4.2.0b4.dist-info/RECORD,,
|
File without changes
|
File without changes
|