pyerualjetwork 4.6b0__py3-none-any.whl → 4.6.1b0__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/model_operations.py +27 -14
- pyerualjetwork/model_operations_cuda.py +42 -39
- pyerualjetwork/planeat.py +3 -1
- pyerualjetwork/planeat_cuda.py +3 -1
- {pyerualjetwork-4.6b0.dist-info → pyerualjetwork-4.6.1b0.dist-info}/METADATA +1 -1
- {pyerualjetwork-4.6b0.dist-info → pyerualjetwork-4.6.1b0.dist-info}/RECORD +9 -9
- {pyerualjetwork-4.6b0.dist-info → pyerualjetwork-4.6.1b0.dist-info}/WHEEL +0 -0
- {pyerualjetwork-4.6b0.dist-info → pyerualjetwork-4.6.1b0.dist-info}/top_level.txt +0 -0
pyerualjetwork/__init__.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
__version__ = "4.
|
1
|
+
__version__ = "4.6.1b0"
|
2
2
|
__update__ = """* Changes: https://github.com/HCB06/PyerualJetwork/blob/main/CHANGES
|
3
3
|
* PyerualJetwork Homepage: https://github.com/HCB06/PyerualJetwork/tree/main
|
4
4
|
* PyerualJetwork document: https://github.com/HCB06/PyerualJetwork/blob/main/Welcome_to_PyerualJetwork/PYERUALJETWORK_USER_MANUEL_AND_LEGAL_INFORMATION(EN).pdf
|
@@ -36,7 +36,7 @@ def save_model(model_name,
|
|
36
36
|
|
37
37
|
model_path: (str): Path where the model will be saved. For example: C:/Users/beydili/Desktop/denemePLAN/ default: ''
|
38
38
|
|
39
|
-
activation_potentiation: (list): For deeper PLAN networks, activation function parameters. For more information please run this code: plan.activations_list() default: ['linear']
|
39
|
+
activation_potentiation: (list[str]): For deeper PLAN networks, activation function parameters. Or activation function parameters for MLP layers. For more information please run this code: plan.activations_list() default: ['linear']
|
40
40
|
|
41
41
|
weights_type: (str): Type of weights to save (options: 'txt', 'pkl', 'npy', 'mat'). default: 'npy'
|
42
42
|
|
@@ -66,26 +66,24 @@ def save_model(model_name,
|
|
66
66
|
print(Fore.RED + "ERROR111: Weight Format Type must be 'd' or 'f' or 'raw' from: save_model" + Style.RESET_ALL)
|
67
67
|
sys.exit()
|
68
68
|
|
69
|
+
NeuronCount = []
|
70
|
+
SynapseCount = []
|
71
|
+
|
69
72
|
if model_type == 'PLAN':
|
70
73
|
class_count = W.shape[0]
|
71
74
|
|
72
|
-
NeuronCount = 0
|
73
|
-
SynapseCount = 0
|
74
|
-
|
75
75
|
try:
|
76
|
-
|
77
|
-
|
76
|
+
NeuronCount.append(np.shape(W)[1])
|
77
|
+
NeuronCount.append(np.shape(W)[0])
|
78
|
+
SynapseCount.append(np.shape(W)[0] * np.shape(W)[1])
|
78
79
|
except:
|
79
80
|
|
80
|
-
print(Fore.RED + "ERROR: Weight matrices
|
81
|
+
print(Fore.RED + "ERROR: Weight matrices have a problem from: save_model" + Style.RESET_ALL)
|
81
82
|
sys.exit()
|
82
83
|
|
83
84
|
elif model_type == 'MLP':
|
84
85
|
class_count = W[-1].shape[0]
|
85
86
|
|
86
|
-
NeuronCount = []
|
87
|
-
SynapseCount = []
|
88
|
-
|
89
87
|
NeuronCount.append(np.shape(W[0])[1])
|
90
88
|
|
91
89
|
for i in range(len(W)):
|
@@ -94,13 +92,26 @@ def save_model(model_name,
|
|
94
92
|
SynapseCount.append(np.shape(W[i])[0] * np.shape(W[i])[1])
|
95
93
|
except:
|
96
94
|
|
97
|
-
print(Fore.RED + "ERROR: Weight matrices
|
95
|
+
print(Fore.RED + "ERROR: Weight matrices have a problem from: save_model" + Style.RESET_ALL)
|
98
96
|
sys.exit()
|
99
97
|
|
100
98
|
SynapseCount.append(' ')
|
101
99
|
|
102
100
|
activation_potentiation.append('')
|
103
101
|
activation_potentiation.insert(0, '')
|
102
|
+
|
103
|
+
if isinstance(activation_potentiation, str):
|
104
|
+
activation_potentiation = [activation_potentiation]
|
105
|
+
activation_potentiation.append('')
|
106
|
+
|
107
|
+
if len(activation_potentiation) > len(NeuronCount):
|
108
|
+
for i in range(len(activation_potentiation) - len(NeuronCount)):
|
109
|
+
NeuronCount.append('')
|
110
|
+
|
111
|
+
if len(activation_potentiation) > len(SynapseCount):
|
112
|
+
for i in range(len(activation_potentiation) - len(SynapseCount)):
|
113
|
+
SynapseCount.append('')
|
114
|
+
|
104
115
|
|
105
116
|
if scaler_params != None:
|
106
117
|
|
@@ -273,6 +284,8 @@ def load_model(model_name,
|
|
273
284
|
if WeightType == 'mat':
|
274
285
|
W[-1] = W[-1]['w']
|
275
286
|
|
287
|
+
if model_type == 'PLAN': W = np.array(W[0], dtype=W[0].dtype)
|
288
|
+
|
276
289
|
return W, None, None, activation_potentiation, scaler_params, None, model_type
|
277
290
|
|
278
291
|
|
@@ -374,15 +387,15 @@ def predict_model_ram(Input, W, scaler_params=None, activation_potentiation=['li
|
|
374
387
|
|
375
388
|
scaler_params (list): standard scaler params list: mean,std. (optional) Default: None.
|
376
389
|
|
377
|
-
activation_potentiation (list):
|
390
|
+
activation_potentiation (list[str]): activation list for deep PLAN or activation list for MLP layers. Default: ['linear']
|
378
391
|
|
379
392
|
is_mlp (bool, optional): Predict from PLAN model or MLP model ? Default: False (PLAN)
|
380
393
|
Returns:
|
381
394
|
ndarray: Output from the model.
|
382
395
|
"""
|
383
396
|
|
384
|
-
from data_operations import standard_scaler
|
385
|
-
from activation_functions import apply_activation
|
397
|
+
from .data_operations import standard_scaler
|
398
|
+
from .activation_functions import apply_activation
|
386
399
|
|
387
400
|
try:
|
388
401
|
|
@@ -39,7 +39,7 @@ def save_model(model_name,
|
|
39
39
|
|
40
40
|
model_path: (str): Path where the model will be saved. For example: C:/Users/beydili/Desktop/denemePLAN/ default: ''
|
41
41
|
|
42
|
-
activation_potentiation: (list): For deeper PLAN networks, activation function parameters. Or activation
|
42
|
+
activation_potentiation: (list[str]): For deeper PLAN networks, activation function parameters. Or activation function parameters for MLP layers. For more information please run this code: plan.activations_list() default: ['linear']
|
43
43
|
|
44
44
|
weights_type: (str): Type of weights to save (options: 'txt', 'pkl', 'npy', 'mat'). default: 'npy'
|
45
45
|
|
@@ -69,36 +69,34 @@ def save_model(model_name,
|
|
69
69
|
if weights_format != 'd' and weights_format != 'f' and weights_format != 'raw':
|
70
70
|
print(Fore.RED + "ERROR111: Weight Format Type must be 'd' or 'f' or 'raw' from: save_model" + Style.RESET_ALL)
|
71
71
|
sys.exit()
|
72
|
+
|
73
|
+
NeuronCount = []
|
74
|
+
SynapseCount = []
|
72
75
|
|
73
76
|
if model_type == 'PLAN':
|
74
77
|
class_count = W.shape[0]
|
75
|
-
|
76
|
-
NeuronCount = 0
|
77
|
-
SynapseCount = 0
|
78
|
-
|
78
|
+
|
79
79
|
try:
|
80
|
-
|
81
|
-
|
80
|
+
NeuronCount.append(cp.shape(W)[1])
|
81
|
+
NeuronCount.append(cp.shape(W)[0])
|
82
|
+
SynapseCount.append(cp.shape(W)[0] * cp.shape(W)[1])
|
82
83
|
except:
|
83
84
|
|
84
|
-
print(Fore.RED + "ERROR: Weight matrices
|
85
|
+
print(Fore.RED + "ERROR: Weight matrices have a problem from: save_model" + Style.RESET_ALL)
|
85
86
|
sys.exit()
|
86
87
|
|
87
88
|
elif model_type == 'MLP':
|
88
89
|
class_count = W[-1].shape[0]
|
89
90
|
|
90
|
-
NeuronCount = []
|
91
|
-
SynapseCount = []
|
92
|
-
|
93
91
|
NeuronCount.append(cp.shape(W[0])[1])
|
94
92
|
|
95
93
|
for i in range(len(W)):
|
96
94
|
try:
|
97
|
-
|
98
|
-
|
95
|
+
NeuronCount.append(cp.shape(W[i])[0])
|
96
|
+
SynapseCount.append(cp.shape(W[i])[0] * cp.shape(W[i])[1])
|
99
97
|
except:
|
100
98
|
|
101
|
-
print(Fore.RED + "ERROR: Weight matrices
|
99
|
+
print(Fore.RED + "ERROR: Weight matrices have a problem from: save_model" + Style.RESET_ALL)
|
102
100
|
sys.exit()
|
103
101
|
|
104
102
|
SynapseCount.append(' ')
|
@@ -106,6 +104,18 @@ def save_model(model_name,
|
|
106
104
|
activation_potentiation.append('')
|
107
105
|
activation_potentiation.insert(0, '')
|
108
106
|
|
107
|
+
if isinstance(activation_potentiation, str):
|
108
|
+
activation_potentiation = [activation_potentiation]
|
109
|
+
activation_potentiation.append('')
|
110
|
+
|
111
|
+
if len(activation_potentiation) > len(NeuronCount):
|
112
|
+
for i in range(len(activation_potentiation) - len(NeuronCount)):
|
113
|
+
NeuronCount.append('')
|
114
|
+
|
115
|
+
if len(activation_potentiation) > len(SynapseCount):
|
116
|
+
for i in range(len(activation_potentiation) - len(SynapseCount)):
|
117
|
+
SynapseCount.append('')
|
118
|
+
|
109
119
|
if scaler_params != None:
|
110
120
|
|
111
121
|
if len(scaler_params) > len(activation_potentiation):
|
@@ -282,7 +292,7 @@ def load_model(model_name,
|
|
282
292
|
if WeightType == 'mat':
|
283
293
|
W[-1] = W[-1]['w']
|
284
294
|
|
285
|
-
if model_type == 'PLAN': W = cp.array(W[0], dtype=W[0])
|
295
|
+
if model_type == 'PLAN': W = cp.array(W[0], dtype=W[0].dtype)
|
286
296
|
|
287
297
|
return W, None, None, activation_potentiation, scaler_params, None, model_type
|
288
298
|
|
@@ -376,41 +386,34 @@ def reverse_predict_model_ssd(output, model_name, model_path='', dtype=cp.float3
|
|
376
386
|
sys.exit()
|
377
387
|
|
378
388
|
|
379
|
-
def
|
389
|
+
def predict_model_ram(Input, W, scaler_params=None, activation_potentiation=['linear'], is_mlp=False):
|
380
390
|
|
381
391
|
"""
|
382
392
|
Function to make a prediction using a potentiation learning artificial neural network (PLAN).
|
383
|
-
from
|
393
|
+
from memory.
|
384
394
|
|
385
395
|
Args:
|
386
|
-
Input (list or ndarray
|
396
|
+
Input (list or ndarray): Input data for the model (single vector or single matrix).
|
387
397
|
|
388
|
-
|
398
|
+
W (list of ndarrays): Weights of the model.
|
389
399
|
|
390
|
-
|
400
|
+
scaler_params (list): standard scaler params list: mean,std. (optional) Default: None.
|
391
401
|
|
392
|
-
|
402
|
+
activation_potentiation (list[str]): activation list for deep PLAN or activation list for MLP layers. Default: ['linear']
|
403
|
+
|
404
|
+
is_mlp (bool, optional): Predict from PLAN model or MLP model ? Default: False (PLAN)
|
393
405
|
Returns:
|
394
|
-
|
406
|
+
cupyarray: Output from the model.
|
395
407
|
"""
|
396
|
-
|
397
|
-
Input = cp.array(Input, dtype=dtype, copy=False)
|
398
|
-
|
399
|
-
from .activation_functions_cuda import apply_activation
|
400
|
-
from .data_operations_cuda import standard_scaler
|
401
|
-
|
402
|
-
try:
|
403
408
|
|
404
|
-
|
405
|
-
|
406
|
-
activation_potentiation = model[get_act_pot()]
|
407
|
-
scaler_params = model[get_scaler()]
|
408
|
-
W = model[get_weights()]
|
409
|
-
model_type = model[get_model_type()]
|
409
|
+
from .data_operations_cuda import standard_scaler
|
410
|
+
from .activation_functions_cuda import apply_activation
|
410
411
|
|
412
|
+
try:
|
413
|
+
|
411
414
|
Input = standard_scaler(None, Input, scaler_params)
|
412
|
-
|
413
|
-
if
|
415
|
+
|
416
|
+
if is_mlp:
|
414
417
|
|
415
418
|
layer = Input
|
416
419
|
for i in range(len(W)):
|
@@ -425,9 +428,9 @@ def predict_model_ssd(Input, model_name, model_path='', dtype=cp.float32):
|
|
425
428
|
result = Input @ W.T
|
426
429
|
|
427
430
|
return result
|
428
|
-
|
431
|
+
|
429
432
|
except:
|
430
|
-
print(Fore.RED + "ERROR: Unexpected
|
433
|
+
print(Fore.RED + "ERROR: Unexpected input or wrong model parameters from: predict_model_ram." + Style.RESET_ALL)
|
431
434
|
sys.exit()
|
432
435
|
|
433
436
|
|
pyerualjetwork/planeat.py
CHANGED
@@ -86,6 +86,8 @@ def define_genomes(input_shape, output_shape, population_size, hidden=0, neurons
|
|
86
86
|
population_weights[i][l][j,:] = apply_activation(population_weights[i][l][j,:], population_activations[i])
|
87
87
|
population_weights[i][l][j,:] = normalization(population_weights[i][l][j,:], dtype=dtype)
|
88
88
|
|
89
|
+
return population_weights, population_activations
|
90
|
+
|
89
91
|
else:
|
90
92
|
population_weights = [0] * population_size
|
91
93
|
population_activations = [0] * population_size
|
@@ -105,7 +107,7 @@ def define_genomes(input_shape, output_shape, population_size, hidden=0, neurons
|
|
105
107
|
population_weights[i][j,:] = apply_activation(population_weights[i][j,:], population_activations[i])
|
106
108
|
population_weights[i][j,:] = normalization(population_weights[i][j,:], dtype=dtype)
|
107
109
|
|
108
|
-
|
110
|
+
return np.array(population_weights, dtype=dtype), population_activations
|
109
111
|
|
110
112
|
|
111
113
|
def evolver(weights,
|
pyerualjetwork/planeat_cuda.py
CHANGED
@@ -88,6 +88,8 @@ def define_genomes(input_shape, output_shape, population_size, hidden=0, neurons
|
|
88
88
|
population_weights[i][l][j,:] = apply_activation(population_weights[i][l][j,:], population_activations[i])
|
89
89
|
population_weights[i][l][j,:] = normalization(population_weights[i][l][j,:], dtype=dtype)
|
90
90
|
|
91
|
+
return population_weights, population_activations
|
92
|
+
|
91
93
|
else:
|
92
94
|
population_weights = [0] * population_size
|
93
95
|
population_activations = [0] * population_size
|
@@ -107,7 +109,7 @@ def define_genomes(input_shape, output_shape, population_size, hidden=0, neurons
|
|
107
109
|
population_weights[i][j,:] = apply_activation(population_weights[i][j,:], population_activations[i])
|
108
110
|
population_weights[i][j,:] = normalization(population_weights[i][j,:], dtype=dtype)
|
109
111
|
|
110
|
-
|
112
|
+
return cp.array(population_weights, dtype=dtype), population_activations
|
111
113
|
|
112
114
|
|
113
115
|
def evolver(weights,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pyerualjetwork
|
3
|
-
Version: 4.
|
3
|
+
Version: 4.6.1b0
|
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=iS07tu-qBxUf0BbzlgGOwdjZJa2LhYDX-YwH6u-yY90,1281
|
2
2
|
pyerualjetwork/activation_functions.py,sha256=Ms0AGBqkJuCA42ht64MSQnO54Td_1eDGquedpoBDVbc,7642
|
3
3
|
pyerualjetwork/activation_functions_cuda.py,sha256=5y1Ti3GDfDteQDCUmODwe7tAyDAUlDTKmIikChQ8d6g,7772
|
4
4
|
pyerualjetwork/data_operations.py,sha256=TxfpwHWUpJ2E7IVF2uSmigrwpVL_JxrvGPOrMg2lNuI,15981
|
@@ -10,16 +10,16 @@ pyerualjetwork/loss_functions_cuda.py,sha256=C93IZJcrOpT6HMK9x1O4AHJWXYTkN5WZiqd
|
|
10
10
|
pyerualjetwork/memory_operations.py,sha256=0yCOHcgiNyF4ccMcRlL1Q9F_byG4nzjhmkbpXE_yU6E,13401
|
11
11
|
pyerualjetwork/metrics.py,sha256=q7MkhnZDRbCjFBDDfUgrl8lBYnUT_1ro1LxeBq105pI,6077
|
12
12
|
pyerualjetwork/metrics_cuda.py,sha256=73h9GC7XwmnFCVzFEEiPQfF8CwHIz2wsCbxpZrJtYgw,5061
|
13
|
-
pyerualjetwork/model_operations.py,sha256=
|
14
|
-
pyerualjetwork/model_operations_cuda.py,sha256
|
13
|
+
pyerualjetwork/model_operations.py,sha256=ZjLQrYYbzBtTyEfrH9_gouq-m8r_XawRAO2ohkjYd4U,15500
|
14
|
+
pyerualjetwork/model_operations_cuda.py,sha256=-ag0HjlNFxnhcVY2xHFYqQzxDxyzPfiXl0aTRUSVOnM,16112
|
15
15
|
pyerualjetwork/plan.py,sha256=UyIvPmvHCHwczlc9KHolE4y6CPEeBfhnRN5yznSbnoM,23028
|
16
16
|
pyerualjetwork/plan_cuda.py,sha256=iteqgv7x9Z2Pj4vGOZs6HXS3r0bNaF_smr7ZXaOdRnw,23990
|
17
|
-
pyerualjetwork/planeat.py,sha256=
|
18
|
-
pyerualjetwork/planeat_cuda.py,sha256=
|
17
|
+
pyerualjetwork/planeat.py,sha256=hZIzDbdRjyCA-wdraD0yJyG-Y8J2KadEqlITs-M_jPQ,45281
|
18
|
+
pyerualjetwork/planeat_cuda.py,sha256=uOvhTxG36jVu8_uHN8jSxGQqbwpSIPKqbXT1sFl0kU8,45326
|
19
19
|
pyerualjetwork/ui.py,sha256=JBTFYz5R24XwNKhA3GSW-oYAoiIBxAE3kFGXkvm5gqw,656
|
20
20
|
pyerualjetwork/visualizations.py,sha256=utnX9zQhzmtvBJLOLNGm2jecVVk4zHXABQdjb0XzJac,28352
|
21
21
|
pyerualjetwork/visualizations_cuda.py,sha256=gnoaaazZ-nc9E1ImqXrZBRgQ4Rnpi2qh2yGJ2eLKMlE,28807
|
22
|
-
pyerualjetwork-4.
|
23
|
-
pyerualjetwork-4.
|
24
|
-
pyerualjetwork-4.
|
25
|
-
pyerualjetwork-4.
|
22
|
+
pyerualjetwork-4.6.1b0.dist-info/METADATA,sha256=qLfRiea4Z7tUreDfotddrbNOawMDUWz5dCPotOz0u7w,7507
|
23
|
+
pyerualjetwork-4.6.1b0.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
24
|
+
pyerualjetwork-4.6.1b0.dist-info/top_level.txt,sha256=BRyt62U_r3ZmJpj-wXNOoA345Bzamrj6RbaWsyW4tRg,15
|
25
|
+
pyerualjetwork-4.6.1b0.dist-info/RECORD,,
|
File without changes
|
File without changes
|