pyerualjetwork 4.3.9b6__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.
- pyerualjetwork/__init__.py +1 -1
- pyerualjetwork/planeat.py +13 -45
- {pyerualjetwork-4.3.9b6.dist-info → pyerualjetwork-4.3.9b7.dist-info}/METADATA +1 -1
- {pyerualjetwork-4.3.9b6.dist-info → pyerualjetwork-4.3.9b7.dist-info}/RECORD +6 -6
- {pyerualjetwork-4.3.9b6.dist-info → pyerualjetwork-4.3.9b7.dist-info}/WHEEL +0 -0
- {pyerualjetwork-4.3.9b6.dist-info → pyerualjetwork-4.3.9b7.dist-info}/top_level.txt +0 -0
pyerualjetwork/__init__.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
__version__ = "4.3.
|
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/planeat.py
CHANGED
@@ -17,10 +17,9 @@ import random
|
|
17
17
|
import math
|
18
18
|
|
19
19
|
### LIBRARY IMPORTS ###
|
20
|
-
from .plan import feed_forward
|
21
20
|
from .data_operations import normalization
|
22
21
|
from .ui import loading_bars, initialize_loading_bar
|
23
|
-
from.
|
22
|
+
from .activation_functions import apply_activation, all_activations
|
24
23
|
|
25
24
|
def define_genomes(input_shape, output_shape, population_size, dtype=np.float32):
|
26
25
|
"""
|
@@ -297,6 +296,7 @@ def evolver(weights,
|
|
297
296
|
mutated_W = np.copy(bad_weights)
|
298
297
|
mutated_act = bad_activations.copy()
|
299
298
|
|
299
|
+
|
300
300
|
for i in range(len(bad_weights)):
|
301
301
|
|
302
302
|
if policy == 'aggressive':
|
@@ -399,7 +399,7 @@ def evolver(weights,
|
|
399
399
|
return weights, activation_potentiations
|
400
400
|
|
401
401
|
|
402
|
-
def evaluate(x_population, weights, activation_potentiations
|
402
|
+
def evaluate(x_population, weights, activation_potentiations):
|
403
403
|
"""
|
404
404
|
Evaluates the performance of a population of genomes, applying different activation functions
|
405
405
|
and weights depending on whether reinforcement learning mode is enabled or not.
|
@@ -412,62 +412,30 @@ def evaluate(x_population, weights, activation_potentiations, rl_mode=False, dty
|
|
412
412
|
activation_potentiations (list or str): A list where each entry represents an activation function
|
413
413
|
or a potentiation strategy applied to each genome. If only one
|
414
414
|
activation function is used, this can be a single string.
|
415
|
-
rl_mode (bool, optional): If True, reinforcement learning mode is activated, this accepts x_population is a single genome. (Also weights and activation_potentations a single genomes part.)
|
416
|
-
Default is False.
|
417
|
-
|
418
|
-
dtype (numpy.dtype): Data type for the arrays. np.float32 by default. Example: np.float64 or np.float16. [fp32 for balanced devices, fp64 for strong devices, fp16 for weak devices: not reccomended!] (optional)
|
419
|
-
|
420
415
|
Returns:
|
421
416
|
list: A list of outputs corresponding to each genome in the population after applying the respective
|
422
417
|
activation function and weights.
|
423
418
|
|
424
|
-
Notes:
|
425
|
-
- If `rl_mode` is True:
|
426
|
-
- Accepts x_population is a single genom
|
427
|
-
- The inputs are flattened, and the activation function is applied across the single genom.
|
428
|
-
|
429
|
-
- If `rl_mode` is False:
|
430
|
-
- Accepts x_population is a list of genomes
|
431
|
-
- Each genome is processed individually, and the results are stored in the `outputs` list.
|
432
|
-
|
433
|
-
- `feed_forward()` function is the core function that processes the input with the given weights and activation function.
|
434
|
-
|
435
419
|
Example:
|
436
420
|
```python
|
437
|
-
outputs = evaluate(x_population, weights, activation_potentiations
|
421
|
+
outputs = evaluate(x_population, weights, activation_potentiations)
|
438
422
|
```
|
439
423
|
|
440
424
|
- The function returns a list of outputs after processing the population, where each element corresponds to
|
441
425
|
the output for each genome in `x_population`.
|
442
|
-
"""
|
443
|
-
|
444
|
-
### IF RL_MODE IS TRUE, A SINGLE GENOME IS ASSUMED AS INPUT, A FEEDFORWARD PREDICTION IS MADE, AND THE OUTPUT(NPARRAY) IS RETURNED:
|
426
|
+
"""
|
427
|
+
### THE OUTPUTS ARE RETURNED, WHERE EACH GENOME'S OUTPUT MATCHES ITS INDEX:
|
445
428
|
|
446
|
-
### IF RL_MODE IS FALSE, PREDICTIONS ARE MADE FOR ALL GENOMES IN THE GROUP USING THEIR CORRESPONDING INDEXED INPUTS AND DATA.
|
447
|
-
### THE OUTPUTS ARE RETURNED AS A PYTHON LIST, WHERE EACH GENOME'S OUTPUT MATCHES ITS INDEX:
|
448
|
-
|
449
|
-
if rl_mode == True:
|
450
|
-
Input = np.array(x_population, copy=False, dtype=dtype)
|
451
|
-
Input = Input.ravel()
|
452
|
-
|
453
|
-
if isinstance(activation_potentiations, str):
|
454
|
-
activation_potentiations = [activation_potentiations]
|
455
|
-
|
456
|
-
outputs = feed_forward(Input=Input, is_training=False, activation_potentiation=activation_potentiations, w=weights)
|
457
|
-
|
458
|
-
else:
|
459
|
-
outputs = [0] * len(x_population)
|
460
|
-
for i, genome in enumerate(x_population):
|
461
|
-
|
462
|
-
Input = np.array(genome, copy=False)
|
463
|
-
Input = Input.ravel()
|
464
429
|
|
465
|
-
|
466
|
-
|
430
|
+
if isinstance(activation_potentiations, str):
|
431
|
+
activation_potentiations = [activation_potentiations]
|
432
|
+
else:
|
433
|
+
activation_potentiations = [item if isinstance(item, list) else [item] for item in activation_potentiations]
|
467
434
|
|
468
|
-
|
435
|
+
x_population = apply_activation(x_population, activation_potentiations)
|
436
|
+
result = x_population @ weights.T
|
469
437
|
|
470
|
-
return
|
438
|
+
return result
|
471
439
|
|
472
440
|
|
473
441
|
def cross_over(first_parent_W,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pyerualjetwork
|
3
|
-
Version: 4.3.
|
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=
|
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
|
@@ -13,12 +13,12 @@ pyerualjetwork/model_operations.py,sha256=MCSCNYiiICRVZITobtS3ZIWmH5Q9gjyELuH32s
|
|
13
13
|
pyerualjetwork/model_operations_cuda.py,sha256=NT01BK5nrDYE7H1x3KnSI8gmx0QTGGB0mP_LqEb1uuU,13157
|
14
14
|
pyerualjetwork/plan.py,sha256=mcVxwBus_GwfYjWLMwx8KDc25uJT8l773l-mHCfa0Xk,23558
|
15
15
|
pyerualjetwork/plan_cuda.py,sha256=8uEyYdQQX122Hcc-XfFoPSiCeLADt-y-cGX3AuRYPt0,24440
|
16
|
-
pyerualjetwork/planeat.py,sha256=
|
16
|
+
pyerualjetwork/planeat.py,sha256=OxwSjfSFPwh7kVrhnuAkr8Lrk73GB-Wk2ajUFIfZcbQ,37556
|
17
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.
|
22
|
-
pyerualjetwork-4.3.
|
23
|
-
pyerualjetwork-4.3.
|
24
|
-
pyerualjetwork-4.3.
|
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,,
|
File without changes
|
File without changes
|