pyerualjetwork 4.3.10b0__py3-none-any.whl → 4.3.10b2__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/fitness_functions.py +51 -45
- pyerualjetwork/fitness_functions_cuda.py +41 -50
- pyerualjetwork/plan.py +12 -12
- pyerualjetwork/plan_cuda.py +10 -10
- {pyerualjetwork-4.3.10b0.dist-info → pyerualjetwork-4.3.10b2.dist-info}/METADATA +1 -1
- {pyerualjetwork-4.3.10b0.dist-info → pyerualjetwork-4.3.10b2.dist-info}/RECORD +9 -9
- {pyerualjetwork-4.3.10b0.dist-info → pyerualjetwork-4.3.10b2.dist-info}/WHEEL +0 -0
- {pyerualjetwork-4.3.10b0.dist-info → pyerualjetwork-4.3.10b2.dist-info}/top_level.txt +0 -0
pyerualjetwork/__init__.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
__version__ = "4.3.
|
1
|
+
__version__ = "4.3.10b2"
|
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,72 +1,78 @@
|
|
1
1
|
import numpy as np
|
2
|
-
|
2
|
+
|
3
|
+
def pairwise_distances(X):
|
4
|
+
"""
|
5
|
+
Pairwise Euclidean distances using NumPy.
|
6
|
+
:param X: A (n_samples, n_features) NumPy array.
|
7
|
+
:return: A 2D NumPy array of distances (n_samples, n_samples).
|
8
|
+
"""
|
9
|
+
X = X.reshape(X.shape[0], -1)
|
10
|
+
r = np.sum(X**2, axis=1, keepdims=True)
|
11
|
+
|
12
|
+
distances = np.maximum(r - 2 * np.dot(X, X.T) + r.T, 0.0)
|
13
|
+
|
14
|
+
return np.sqrt(distances)
|
3
15
|
|
4
16
|
def diversity_score(population):
|
5
17
|
"""
|
6
18
|
Calculates the diversity score of a population based on the
|
7
19
|
Euclidean distances between individuals in the population.
|
8
|
-
|
9
|
-
:param population:
|
10
|
-
|
11
|
-
:return:
|
12
|
-
which is a measure of how spread out or diverse the population is in terms of their characteristics.
|
20
|
+
|
21
|
+
:param population: A NumPy array of shape (n_samples, n_features),
|
22
|
+
where each element is an individual weight matrix (flattened).
|
23
|
+
:return: A NumPy array of diversity scores for each weight matrix.
|
13
24
|
"""
|
14
25
|
if len(population) < 2:
|
15
|
-
return
|
16
|
-
|
26
|
+
return np.zeros(len(population))
|
27
|
+
|
17
28
|
population = np.nan_to_num(population, nan=0.0)
|
18
29
|
|
19
|
-
distances =
|
30
|
+
distances = pairwise_distances(population)
|
20
31
|
distances = np.maximum(distances, 1e-10)
|
32
|
+
|
33
|
+
n_samples = len(population)
|
34
|
+
|
35
|
+
mask = np.ones((n_samples, n_samples), dtype=bool)
|
36
|
+
np.fill_diagonal(mask, 0)
|
37
|
+
|
38
|
+
avg_distances = np.sum(distances * mask, axis=1) / (n_samples - 1)
|
21
39
|
|
22
|
-
avg_distance = np.mean(distances)
|
23
40
|
if population.shape[1] == 0:
|
24
|
-
return
|
41
|
+
return np.zeros(len(population))
|
25
42
|
|
26
43
|
max_possible_distance = np.sqrt(population.shape[1])
|
27
|
-
max_possible_distance = max(max_possible_distance, 1e-10)
|
44
|
+
max_possible_distance = float(max(max_possible_distance, 1e-10))
|
45
|
+
|
46
|
+
diversity_scores = avg_distances / max_possible_distance
|
28
47
|
|
29
|
-
|
30
|
-
|
48
|
+
return diversity_scores
|
49
|
+
|
50
|
+
|
31
51
|
|
32
52
|
def multi_head_fitness(y_true, y_pred, diversity_score, accuracy, alpha=2, beta=1.5, lambda_div=0.05):
|
33
53
|
"""
|
34
|
-
|
35
|
-
specified parameters.
|
54
|
+
Computes a fitness score based on accuracy, margin loss, and diversity score.
|
36
55
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
the overall performance of the model
|
46
|
-
@param accuracy Accuracy is a measure of the correct predictions made by a model. It is typically
|
47
|
-
calculated as the number of correct predictions divided by the total number of predictions. In the
|
48
|
-
context of the `multi_head_fitness` function, the accuracy parameter represents the accuracy
|
49
|
-
of the model's predictions.
|
50
|
-
@param alpha Alpha is a parameter that controls the impact of accuracy on the overall fitness score
|
51
|
-
in the multi_head_fitness function. It is used as an exponent to raise the accuracy value
|
52
|
-
to, influencing its contribution to the fitness calculation.
|
53
|
-
@param beta The `beta` parameter in the `multi_head_fitness` function is used as an exponent
|
54
|
-
in the fitness calculation formula. It controls the impact of the margin loss term on the overall
|
55
|
-
fitness value. A higher value of `beta` will amplify the effect of the margin loss term, making it
|
56
|
-
@param lambda_div The `lambda_div` parameter in the `multi_head_fitness` function represents
|
57
|
-
the weight given to the diversity score in calculating the fitness value. It is a hyperparameter
|
58
|
-
that controls the impact of diversity score on the overall fitness calculation. A higher value of
|
59
|
-
`lambda_div` will increase the importance
|
60
|
-
@return The function `multi_head_fitness` returns the fitness value calculated based on the
|
61
|
-
input parameters `y_true`, `y_pred`, `diversity_score`, `accuracy`, and optional parameters `alpha`,
|
62
|
-
`beta`, and `lambda_div`. The fitness value is computed using a formula that combines accuracy,
|
63
|
-
margin loss, and diversity score with specified weights and coefficients.
|
56
|
+
:param y_true: Ground truth labels (NumPy array).
|
57
|
+
:param y_pred: Predicted labels (NumPy array).
|
58
|
+
:param diversity_score: Diversity score for a single weight matrix.
|
59
|
+
:param accuracy: Model accuracy.
|
60
|
+
:param alpha: Exponent for accuracy impact.
|
61
|
+
:param beta: Exponent for margin loss impact.
|
62
|
+
:param lambda_div: Weight for diversity score influence.
|
63
|
+
:return: Computed fitness value.
|
64
64
|
"""
|
65
65
|
incorrect = y_true != y_pred
|
66
|
-
|
66
|
+
|
67
|
+
if np.any(incorrect):
|
68
|
+
margin_loss = np.abs(y_true[incorrect] - y_pred[incorrect]).mean()
|
69
|
+
else:
|
70
|
+
margin_loss = 0.0
|
67
71
|
|
68
72
|
margin_loss = np.nan_to_num(margin_loss, nan=0.0)
|
69
73
|
accuracy = max(accuracy, 1e-10)
|
70
|
-
|
74
|
+
|
71
75
|
fitness = (accuracy ** alpha) * ((1 - margin_loss) ** beta) * (1 + lambda_div * diversity_score)
|
76
|
+
fitness = np.nan_to_num(fitness, nan=0.0, posinf=1e10, neginf=-1e10)
|
77
|
+
|
72
78
|
return fitness
|
@@ -1,85 +1,76 @@
|
|
1
1
|
import cupy as cp
|
2
2
|
|
3
|
-
def
|
3
|
+
def pairwise_distances(X):
|
4
4
|
"""
|
5
|
-
Pairwise Euclidean distances
|
5
|
+
Pairwise Euclidean distances using CuPy.
|
6
|
+
:param X: A (n_samples, n_features) CuPy array.
|
7
|
+
:return: A 2D CuPy array of distances (n_samples, n_samples).
|
6
8
|
"""
|
7
|
-
|
8
|
-
r =
|
9
|
+
X = X.reshape(X.shape[0], -1)
|
10
|
+
r = cp.sum(X**2, axis=1, keepdims=True)
|
9
11
|
|
10
12
|
distances = cp.maximum(r - 2 * cp.dot(X, X.T) + r.T, 0.0)
|
11
13
|
|
12
|
-
|
13
|
-
return cp.sqrt(distances[triu_indices])
|
14
|
-
|
14
|
+
return cp.sqrt(distances)
|
15
15
|
|
16
16
|
def diversity_score(population):
|
17
17
|
"""
|
18
18
|
Calculates the diversity score of a population based on the
|
19
19
|
Euclidean distances between individuals in the population.
|
20
20
|
|
21
|
-
:param population:
|
22
|
-
|
23
|
-
:return: The function returns the diversity score,
|
24
|
-
which is a measure of how spread out or diverse the population is in terms of their characteristics.
|
21
|
+
:param population: A CuPy array of shape (n_samples, n_features).
|
22
|
+
:return: The function returns a CuPy array of diversity scores for each matrix in the population.
|
25
23
|
"""
|
26
24
|
if len(population) < 2:
|
27
|
-
return
|
25
|
+
return cp.zeros(len(population))
|
28
26
|
|
29
27
|
population = cp.nan_to_num(population, nan=0.0)
|
30
28
|
|
31
|
-
distances =
|
29
|
+
distances = pairwise_distances(population)
|
32
30
|
distances = cp.maximum(distances, 1e-10)
|
33
31
|
|
34
|
-
|
35
|
-
if population.shape[1] == 0:
|
36
|
-
return 0
|
32
|
+
n_samples = len(population)
|
37
33
|
|
34
|
+
mask = cp.ones((n_samples, n_samples), dtype=bool)
|
35
|
+
cp.fill_diagonal(mask, 0)
|
36
|
+
|
37
|
+
avg_distances = cp.sum(distances * mask, axis=1) / (n_samples - 1)
|
38
|
+
|
39
|
+
if population.shape[1] == 0:
|
40
|
+
return cp.zeros(len(population))
|
41
|
+
|
38
42
|
max_possible_distance = cp.sqrt(population.shape[1])
|
39
43
|
max_possible_distance = float(max(max_possible_distance, 1e-10))
|
40
44
|
|
41
|
-
|
42
|
-
|
45
|
+
diversity_scores = avg_distances / max_possible_distance
|
46
|
+
|
47
|
+
return diversity_scores
|
43
48
|
|
44
49
|
|
45
50
|
def multi_head_fitness(y_true, y_pred, diversity_score, accuracy, alpha=2, beta=1.5, lambda_div=0.05):
|
46
51
|
"""
|
47
|
-
|
48
|
-
specified parameters.
|
52
|
+
Computes a fitness score based on accuracy, margin loss, and diversity score.
|
49
53
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
the overall performance of the model
|
59
|
-
@param accuracy Accuracy is a measure of the correct predictions made by a model. It is typically
|
60
|
-
calculated as the number of correct predictions divided by the total number of predictions. In the
|
61
|
-
context of the `multi_head_fitness` function, the accuracy parameter represents the accuracy
|
62
|
-
of the model's predictions.
|
63
|
-
@param alpha Alpha is a parameter that controls the impact of accuracy on the overall fitness score
|
64
|
-
in the multi_head_fitness function. It is used as an exponent to raise the accuracy value
|
65
|
-
to, influencing its contribution to the fitness calculation.
|
66
|
-
@param beta The `beta` parameter in the `multi_head_fitness` function is used as an exponent
|
67
|
-
in the fitness calculation formula. It controls the impact of the margin loss term on the overall
|
68
|
-
fitness value. A higher value of `beta` will amplify the effect of the margin loss term, making it
|
69
|
-
@param lambda_div The `lambda_div` parameter in the `multi_head_fitness` function represents
|
70
|
-
the weight given to the diversity score in calculating the fitness value. It is a hyperparameter
|
71
|
-
that controls the impact of diversity score on the overall fitness calculation. A higher value of
|
72
|
-
`lambda_div` will increase the importance
|
73
|
-
@return The function `multi_head_fitness` returns the fitness value calculated based on the
|
74
|
-
icput parameters `y_true`, `y_pred`, `diversity_score`, `accuracy`, and optional parameters `alpha`,
|
75
|
-
`beta`, and `lambda_div`. The fitness value is computed using a formula that combines accuracy,
|
76
|
-
margin loss, and diversity score with specified weights and coefficients.
|
54
|
+
:param y_true: Ground truth labels (CupPy array).
|
55
|
+
:param y_pred: Predicted labels (CupPy array).
|
56
|
+
:param diversity_score: Diversity score for a single weight matrix.
|
57
|
+
:param accuracy: Model accuracy.
|
58
|
+
:param alpha: Exponent for accuracy impact.
|
59
|
+
:param beta: Exponent for margin loss impact.
|
60
|
+
:param lambda_div: Weight for diversity score influence.
|
61
|
+
:return: Computed fitness value.
|
77
62
|
"""
|
78
63
|
incorrect = y_true != y_pred
|
79
|
-
|
64
|
+
|
65
|
+
if cp.any(incorrect):
|
66
|
+
margin_loss = cp.abs(y_true[incorrect] - y_pred[incorrect]).mean()
|
67
|
+
else:
|
68
|
+
margin_loss = 0.0
|
80
69
|
|
81
70
|
margin_loss = cp.nan_to_num(margin_loss, nan=0.0)
|
82
|
-
accuracy = max(accuracy, 1e-10)
|
83
|
-
|
71
|
+
accuracy = max(accuracy, 1e-10)
|
72
|
+
|
84
73
|
fitness = (accuracy ** alpha) * ((1 - margin_loss) ** beta) * (1 + lambda_div * diversity_score)
|
74
|
+
fitness = cp.nan_to_num(fitness, nan=0.0, posinf=1e10, neginf=-1e10)
|
75
|
+
|
85
76
|
return fitness
|
pyerualjetwork/plan.py
CHANGED
@@ -170,8 +170,8 @@ def learner(x_train, y_train, optimizer, fitness, fit_start=True, gen=None, batc
|
|
170
170
|
|
171
171
|
"""
|
172
172
|
|
173
|
-
from fitness_functions import diversity_score
|
174
|
-
from planeat import define_genomes
|
173
|
+
from .fitness_functions import diversity_score
|
174
|
+
from .planeat import define_genomes
|
175
175
|
|
176
176
|
data = 'Train'
|
177
177
|
|
@@ -212,7 +212,7 @@ def learner(x_train, y_train, optimizer, fitness, fit_start=True, gen=None, batc
|
|
212
212
|
div_score = diversity_score(weight_pop)
|
213
213
|
|
214
214
|
else:
|
215
|
-
weight_pop = [0]
|
215
|
+
weight_pop = [np.random.uniform(-1, 1, (len(y_train[0]), x_train[0].shape[0])) for _ in range(pop_size)]
|
216
216
|
act_pop = [0] * pop_size
|
217
217
|
|
218
218
|
if start_this_act is not None and start_this_W is not None:
|
@@ -243,7 +243,7 @@ def learner(x_train, y_train, optimizer, fitness, fit_start=True, gen=None, batc
|
|
243
243
|
model = evaluate(x_train_batch, y_train_batch, W=weight_pop[j], activation_potentiation=act_pop[j])
|
244
244
|
acc = model[get_acc()]
|
245
245
|
|
246
|
-
fit_score = fitness(y_train_batch, model[
|
246
|
+
fit_score = fitness(y_train_batch, model[get_preds_softmax()], div_score[j], acc)
|
247
247
|
|
248
248
|
target_pop.append(fit_score)
|
249
249
|
|
@@ -298,7 +298,7 @@ def learner(x_train, y_train, optimizer, fitness, fit_start=True, gen=None, batc
|
|
298
298
|
train_model = evaluate(x_train, y_train, W=best_weight,
|
299
299
|
activation_potentiation=final_activations)
|
300
300
|
|
301
|
-
fit_score = fitness(y_train, train_model[
|
301
|
+
fit_score = fitness(y_train, train_model[get_preds_softmax()], best_div_score, train_model[get_acc()])
|
302
302
|
|
303
303
|
print('\nActivations: ', final_activations)
|
304
304
|
print(f'Train Accuracy:', train_model[get_acc()])
|
@@ -310,14 +310,14 @@ def learner(x_train, y_train, optimizer, fitness, fit_start=True, gen=None, batc
|
|
310
310
|
# Display final visualizations
|
311
311
|
display_visualizations_for_learner(viz_objects, best_weight, data, best_acc,
|
312
312
|
fit_score, y_train, interval)
|
313
|
-
return best_weight, best_model[
|
313
|
+
return best_weight, best_model[get_preds_softmax()], best_acc, final_activations
|
314
314
|
|
315
315
|
progress.update(1)
|
316
316
|
|
317
317
|
if batch_size != 1:
|
318
318
|
train_model = evaluate(x_train, y_train, best_weight, final_activations)
|
319
319
|
|
320
|
-
fit_score = fitness(y_train, train_model[
|
320
|
+
fit_score = fitness(y_train, train_model[get_preds_softmax()], best_div_score, train_model[get_acc()])
|
321
321
|
|
322
322
|
print('\nActivations: ', final_activations)
|
323
323
|
print(f'Train Accuracy:', train_model[get_acc()])
|
@@ -345,7 +345,7 @@ def learner(x_train, y_train, optimizer, fitness, fit_start=True, gen=None, batc
|
|
345
345
|
train_model = evaluate(x_train, y_train, W=best_weight,
|
346
346
|
activation_potentiation=final_activations)
|
347
347
|
|
348
|
-
fit_score = fitness(y_train, train_model[
|
348
|
+
fit_score = fitness(y_train, train_model[get_preds_softmax()], best_div_score, train_model[get_acc()])
|
349
349
|
|
350
350
|
print('\nActivations: ', final_activations)
|
351
351
|
print(f'Train Accuracy:', train_model[get_acc()])
|
@@ -354,14 +354,14 @@ def learner(x_train, y_train, optimizer, fitness, fit_start=True, gen=None, batc
|
|
354
354
|
# Display final visualizations
|
355
355
|
display_visualizations_for_learner(viz_objects, best_weight, data, best_acc,
|
356
356
|
fit_score, y_train, interval)
|
357
|
-
return best_weight, best_model[
|
357
|
+
return best_weight, best_model[get_preds_softmax()], best_acc, final_activations
|
358
358
|
|
359
359
|
# Final evaluation
|
360
360
|
progress.close()
|
361
361
|
train_model = evaluate(x_train, y_train, W=best_weight,
|
362
362
|
activation_potentiation=final_activations)
|
363
363
|
|
364
|
-
fit_score = fitness(y_train, train_model[
|
364
|
+
fit_score = fitness(y_train, train_model[get_preds_softmax()], best_div_score, train_model[get_acc()])
|
365
365
|
|
366
366
|
print('\nActivations: ', final_activations)
|
367
367
|
print(f'Train Accuracy:', train_model[get_acc()])
|
@@ -369,7 +369,7 @@ def learner(x_train, y_train, optimizer, fitness, fit_start=True, gen=None, batc
|
|
369
369
|
|
370
370
|
# Display final visualizations
|
371
371
|
display_visualizations_for_learner(viz_objects, best_weight, data, best_acc, fit_score, y_train, interval)
|
372
|
-
return best_weight, best_model[
|
372
|
+
return best_weight, best_model[get_preds_softmax()], best_acc, final_activations
|
373
373
|
|
374
374
|
|
375
375
|
def evaluate(
|
@@ -400,4 +400,4 @@ def evaluate(
|
|
400
400
|
accuracy = (np.argmax(result, axis=1) == np.argmax(y_test, axis=1)).mean()
|
401
401
|
softmax_preds = np.exp(result) / (np.sum(np.exp(result), axis=1, keepdims=True) + epsilon)
|
402
402
|
|
403
|
-
return W,
|
403
|
+
return W, result, accuracy, None, None, softmax_preds
|
pyerualjetwork/plan_cuda.py
CHANGED
@@ -220,7 +220,7 @@ def learner(x_train, y_train, optimizer, fitness, fit_start=True, gen=None, batc
|
|
220
220
|
div_score = diversity_score(weight_pop)
|
221
221
|
|
222
222
|
else:
|
223
|
-
weight_pop = [0]
|
223
|
+
weight_pop = [cp.random.uniform(-1, 1, (len(y_train[0]), x_train[0].shape[0])) for _ in range(pop_size)]
|
224
224
|
act_pop = [0] * pop_size
|
225
225
|
|
226
226
|
if start_this_act is not None and start_this_W is not None:
|
@@ -254,8 +254,8 @@ def learner(x_train, y_train, optimizer, fitness, fit_start=True, gen=None, batc
|
|
254
254
|
model = evaluate(x_train_batch, y_train_batch, W=weight_pop[j], activation_potentiation=act_pop[j])
|
255
255
|
acc = model[get_acc()]
|
256
256
|
|
257
|
-
fit_score = fitness(y_train_batch, model[
|
258
|
-
|
257
|
+
fit_score = fitness(y_train_batch, model[get_preds_softmax()], div_score[j], acc)
|
258
|
+
|
259
259
|
target_pop.append(fit_score)
|
260
260
|
|
261
261
|
if fit_score >= best_fit:
|
@@ -309,7 +309,7 @@ def learner(x_train, y_train, optimizer, fitness, fit_start=True, gen=None, batc
|
|
309
309
|
train_model = evaluate(x_train, y_train, W=best_weight,
|
310
310
|
activation_potentiation=final_activations)
|
311
311
|
|
312
|
-
fit_score = fitness(y_train, train_model[
|
312
|
+
fit_score = fitness(y_train, train_model[get_preds_softmax()], best_div_score, train_model[get_acc()])
|
313
313
|
|
314
314
|
print('\nActivations: ', final_activations)
|
315
315
|
print(f'Train Accuracy:', train_model[get_acc()])
|
@@ -317,14 +317,14 @@ def learner(x_train, y_train, optimizer, fitness, fit_start=True, gen=None, batc
|
|
317
317
|
|
318
318
|
display_visualizations_for_learner(viz_objects, best_weight, data, best_acc,
|
319
319
|
fit_score, y_train, interval)
|
320
|
-
return best_weight, best_model[
|
320
|
+
return best_weight, best_model[get_preds_softmax()], best_acc, final_activations
|
321
321
|
|
322
322
|
progress.update(1)
|
323
323
|
|
324
324
|
if batch_size != 1:
|
325
325
|
train_model = evaluate(x_train, y_train, best_weight, final_activations)
|
326
326
|
|
327
|
-
fit_score = fitness(y_train, train_model[
|
327
|
+
fit_score = fitness(y_train, train_model[get_preds_softmax()], best_div_score, train_model[get_acc()])
|
328
328
|
|
329
329
|
print('\nActivations: ', final_activations)
|
330
330
|
print(f'Train Accuracy:', train_model[get_acc()])
|
@@ -352,7 +352,7 @@ def learner(x_train, y_train, optimizer, fitness, fit_start=True, gen=None, batc
|
|
352
352
|
train_model = evaluate(x_train, y_train, W=best_weight,
|
353
353
|
activation_potentiation=final_activations)
|
354
354
|
|
355
|
-
fit_score = fitness(y_train, train_model[
|
355
|
+
fit_score = fitness(y_train, train_model[get_preds_softmax()], best_div_score, train_model[get_acc()])
|
356
356
|
|
357
357
|
print('\nActivations: ', final_activations)
|
358
358
|
print(f'Train Accuracy:', train_model[get_acc()])
|
@@ -361,14 +361,14 @@ def learner(x_train, y_train, optimizer, fitness, fit_start=True, gen=None, batc
|
|
361
361
|
# Display final visualizations
|
362
362
|
display_visualizations_for_learner(viz_objects, best_weight, data, best_acc,
|
363
363
|
fit_score, y_train, interval)
|
364
|
-
return best_weight, best_model[
|
364
|
+
return best_weight, best_model[get_preds_softmax()], best_acc, final_activations
|
365
365
|
|
366
366
|
# Final evaluation
|
367
367
|
progress.close()
|
368
368
|
train_model = evaluate(x_train, y_train, W=best_weight,
|
369
369
|
activation_potentiation=final_activations)
|
370
370
|
|
371
|
-
fit_score = fitness(y_train, train_model[
|
371
|
+
fit_score = fitness(y_train, train_model[get_preds_softmax()], best_div_score, train_model[get_acc()])
|
372
372
|
|
373
373
|
print('\nActivations: ', final_activations)
|
374
374
|
print(f'Train Accuracy:', train_model[get_acc()])
|
@@ -376,7 +376,7 @@ def learner(x_train, y_train, optimizer, fitness, fit_start=True, gen=None, batc
|
|
376
376
|
|
377
377
|
# Display final visualizations
|
378
378
|
display_visualizations_for_learner(viz_objects, best_weight, data, best_acc, fit_score, y_train, interval)
|
379
|
-
return best_weight, best_model[
|
379
|
+
return best_weight, best_model[get_preds_softmax()], best_acc, final_activations
|
380
380
|
|
381
381
|
def evaluate(
|
382
382
|
x_test,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pyerualjetwork
|
3
|
-
Version: 4.3.
|
3
|
+
Version: 4.3.10b2
|
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,24 +1,24 @@
|
|
1
|
-
pyerualjetwork/__init__.py,sha256=
|
1
|
+
pyerualjetwork/__init__.py,sha256=DRF05WRIM4ITdnKZ98dzqV5ZrU9gDodseJHR7XZRSVk,642
|
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
|
5
5
|
pyerualjetwork/data_operations_cuda.py,sha256=ZcjmLXE1-HVwedextYdJZ1rgrns1OfSekzFpr1a9m6o,17625
|
6
|
-
pyerualjetwork/fitness_functions.py,sha256=
|
7
|
-
pyerualjetwork/fitness_functions_cuda.py,sha256=
|
6
|
+
pyerualjetwork/fitness_functions.py,sha256=h-eigMH1n7vw2C53PAUGJFvUxtC_sVrFkGYH1zMcEmw,2698
|
7
|
+
pyerualjetwork/fitness_functions_cuda.py,sha256=nncxtoTjF-_UBmACeiohUot5x-sUpsZpTuobFz6Jd4s,2640
|
8
8
|
pyerualjetwork/help.py,sha256=nQ_YbYA2RtuafhuvkreNpX0WWL1I_nzlelwCtvei0_Y,775
|
9
9
|
pyerualjetwork/memory_operations.py,sha256=I7QiZ--xSyRkFF0wcckPwZV7K9emEvyx5aJ3DiRHZFI,13468
|
10
10
|
pyerualjetwork/metrics.py,sha256=q7MkhnZDRbCjFBDDfUgrl8lBYnUT_1ro1LxeBq105pI,6077
|
11
11
|
pyerualjetwork/metrics_cuda.py,sha256=73h9GC7XwmnFCVzFEEiPQfF8CwHIz2wsCbxpZrJtYgw,5061
|
12
12
|
pyerualjetwork/model_operations.py,sha256=MCSCNYiiICRVZITobtS3ZIWmH5Q9gjyELuH32sAdgg4,12649
|
13
13
|
pyerualjetwork/model_operations_cuda.py,sha256=NT01BK5nrDYE7H1x3KnSI8gmx0QTGGB0mP_LqEb1uuU,13157
|
14
|
-
pyerualjetwork/plan.py,sha256=
|
15
|
-
pyerualjetwork/plan_cuda.py,sha256=
|
14
|
+
pyerualjetwork/plan.py,sha256=Bxx4EYlVxVzsdtDCBoy_f_IE0LhrP7GILqyesRQ6x48,20486
|
15
|
+
pyerualjetwork/plan_cuda.py,sha256=K46cayXRowNFuLv_qkmcZIipT-nWn4yZ-UOinODD1iY,21011
|
16
16
|
pyerualjetwork/planeat.py,sha256=QyfPW5k0rvVnowtymI3LXLKp39y69M5DIyNBAeKIhRQ,37568
|
17
17
|
pyerualjetwork/planeat_cuda.py,sha256=zzsEu612Ren5K8YyvIn00RjYBG9Z6AOikiReGAPrBbg,37624
|
18
18
|
pyerualjetwork/ui.py,sha256=wu2BhU1k-w3Kcho5Jtq4SEKe68ftaUeRGneUOSCVDjU,575
|
19
19
|
pyerualjetwork/visualizations.py,sha256=6uY9U4qGOlG4aIhGdAFcTm2Z5m9Hxww4tAAG61_Vqb8,28294
|
20
20
|
pyerualjetwork/visualizations_cuda.py,sha256=o6MyZUVz040lmdI2kGlOEU2IoxvyWJPhSOKe9vkLMvY,28753
|
21
|
-
pyerualjetwork-4.3.
|
22
|
-
pyerualjetwork-4.3.
|
23
|
-
pyerualjetwork-4.3.
|
24
|
-
pyerualjetwork-4.3.
|
21
|
+
pyerualjetwork-4.3.10b2.dist-info/METADATA,sha256=Fv7c0vWkKDf6rzg4rK30PaUmT1B2MOvJZrpdqGHc5lA,7499
|
22
|
+
pyerualjetwork-4.3.10b2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
23
|
+
pyerualjetwork-4.3.10b2.dist-info/top_level.txt,sha256=BRyt62U_r3ZmJpj-wXNOoA345Bzamrj6RbaWsyW4tRg,15
|
24
|
+
pyerualjetwork-4.3.10b2.dist-info/RECORD,,
|
File without changes
|
File without changes
|