pyerualjetwork 5.47b0__py3-none-any.whl → 5.48__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.
@@ -42,7 +42,7 @@ PyerualJetwork document: https://github.com/HCB06/PyerualJetwork/blob/main/Welco
42
42
  - Contact: tchasancan@gmail.com
43
43
  """
44
44
 
45
- __version__ = "5.47b0"
45
+ __version__ = "5.48"
46
46
  __update__ = """* Changes: https://github.com/HCB06/PyerualJetwork/blob/main/CHANGES
47
47
  * PyerualJetwork Homepage: https://github.com/HCB06/PyerualJetwork/tree/main
48
48
  * PyerualJetwork document: https://github.com/HCB06/PyerualJetwork/blob/main/Welcome_to_PyerualJetwork/PYERUALJETWORK_USER_MANUEL_AND_LEGAL_INFORMATION(EN).pdf
@@ -436,12 +436,12 @@ def find_closest_factors(a):
436
436
  return i, j
437
437
 
438
438
 
439
- def batcher(x_test, y_test, batch_size=1):
439
+ def batcher(x, y, batch_size=1):
440
440
 
441
441
  if batch_size == 1:
442
- return x_test, y_test
442
+ return x, y
443
443
 
444
- y_labels = np.argmax(y_test, axis=1)
444
+ y_labels = np.argmax(y, axis=1)
445
445
 
446
446
  sampled_x, sampled_y = [], []
447
447
 
@@ -453,7 +453,7 @@ def batcher(x_test, y_test, batch_size=1):
453
453
 
454
454
  sampled_indices = np.random.choice(class_indices, num_samples, replace=False)
455
455
 
456
- sampled_x.append(x_test[sampled_indices])
457
- sampled_y.append(y_test[sampled_indices])
456
+ sampled_x.append(x[sampled_indices])
457
+ sampled_y.append(y[sampled_indices])
458
458
 
459
459
  return np.concatenate(sampled_x), np.concatenate(sampled_y)
@@ -484,20 +484,20 @@ def find_closest_factors(a):
484
484
  j = a // i
485
485
  return i, j
486
486
 
487
- def batcher(x_test, y_test, batch_size=1):
487
+ def batcher(x, y, batch_size=1):
488
488
 
489
489
  if batch_size == 1:
490
- return x_test, y_test
490
+ return x, y
491
491
 
492
- y_labels = cp.argmax(y_test, axis=1)
492
+ y_labels = cp.argmax(y, axis=1)
493
493
 
494
494
  unique_labels = cp.unique(y_labels)
495
495
  total_samples = sum(
496
496
  int(cp.sum(y_labels == class_label) * batch_size) for class_label in unique_labels
497
497
  )
498
498
 
499
- sampled_x = cp.empty((total_samples, x_test.shape[1]), dtype=x_test.dtype)
500
- sampled_y = cp.empty((total_samples, y_test.shape[1]), dtype=y_test.dtype)
499
+ sampled_x = cp.empty((total_samples, x.shape[1]), dtype=x.dtype)
500
+ sampled_y = cp.empty((total_samples, y.shape[1]), dtype=y.dtype)
501
501
 
502
502
  offset = 0
503
503
  for class_label in unique_labels:
@@ -507,8 +507,8 @@ def batcher(x_test, y_test, batch_size=1):
507
507
 
508
508
  sampled_indices = cp.random.choice(class_indices, num_samples, replace=False)
509
509
 
510
- sampled_x[offset:offset + num_samples] = x_test[sampled_indices]
511
- sampled_y[offset:offset + num_samples] = y_test[sampled_indices]
510
+ sampled_x[offset:offset + num_samples] = x[sampled_indices]
511
+ sampled_y[offset:offset + num_samples] = y[sampled_indices]
512
512
 
513
513
  offset += num_samples
514
514
 
pyerualjetwork/nn.py CHANGED
@@ -95,14 +95,13 @@ def plan_fit(
95
95
  Returns:
96
96
  numpyarray: (Weight matrix).
97
97
  """
98
-
98
+
99
+ from .cpu.data_ops import normalization
99
100
  if not cuda:
100
- from .cpu.data_ops import normalization
101
- from .cpu.activation_functions import apply_activation
101
+ from cpu.activation_functions import apply_activation
102
102
  array_type = np
103
103
 
104
104
  else:
105
- from .cuda.data_ops import normalization
106
105
  from .cuda.activation_functions import apply_activation
107
106
  array_type = cp
108
107
 
@@ -119,7 +118,7 @@ def plan_fit(
119
118
 
120
119
  weight += y_train.T @ x_train if not cuda else cp.array(y_train).T @ cp.array(x_train)
121
120
 
122
- return normalization(weight, dtype=dtype)
121
+ return normalization(weight.get() if cuda else weight,dtype=dtype)
123
122
 
124
123
 
125
124
  def learn(x_train, y_train, optimizer, template_model, gen, pop_size, fit_start=True, batch_size=1,
@@ -315,16 +314,11 @@ def learn(x_train, y_train, optimizer, template_model, gen, pop_size, fit_start=
315
314
  if model_type == 'PLAN' and transfer_learning:
316
315
  if i == gen_copy[0]:
317
316
 
318
- if cuda:
319
- array_type = cp
320
- else:
321
- array_type = np
322
-
323
317
  model_type = 'PTNN'
324
318
  neurons = neurons_copy
325
319
 
326
320
  for individual in range(len(weight_pop)):
327
- weight_pop[individual] = array_type.copy(best_weight)
321
+ weight_pop[individual] = np.copy(best_weight)
328
322
  activation_potentiations[individual] = final_activations.copy() if isinstance(final_activations, list) else final_activations
329
323
 
330
324
  activation_potentiation = activation_potentiations[0]
@@ -338,13 +332,13 @@ def learn(x_train, y_train, optimizer, template_model, gen, pop_size, fit_start=
338
332
  for l in range(1, len(weight_pop[0])):
339
333
  original_shape = weight_pop[0][l].shape
340
334
 
341
- identity_matrix = array_type.eye(original_shape[0], original_shape[1], dtype=weight_pop[0][l].dtype)
335
+ identity_matrix = np.eye(original_shape[0], original_shape[1], dtype=weight_pop[0][l].dtype)
342
336
  weight_pop[0][l] = identity_matrix
343
337
 
344
338
  for l in range(len(weight_pop)):
345
- weight_pop[l][0] = array_type.copy(best_weight)
339
+ weight_pop[l][0] = np.copy(best_weight)
346
340
 
347
- best_weight = array_type.array(weight_pop[0], dtype=object)
341
+ best_weight = np.array(weight_pop[0], dtype=object)
348
342
  final_activations = act_pop[0]
349
343
  is_mlp = True
350
344
  fit_start = False
@@ -357,10 +351,10 @@ def learn(x_train, y_train, optimizer, template_model, gen, pop_size, fit_start=
357
351
  progress.last_print_n = 0
358
352
  progress.update(0)
359
353
 
360
- x_train_batch, y_train_batch = batcher(x_train, y_train, batch_size=batch_size)
361
-
362
354
  for j in range(pop_size):
363
355
 
356
+ x_train_batch, y_train_batch = batcher(x_train, y_train, batch_size=batch_size)
357
+
364
358
  if fit_start is True and i == 0:
365
359
  if start_this_act is not None and j == 0:
366
360
  pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyerualjetwork
3
- Version: 5.47b0
3
+ Version: 5.48
4
4
  Summary: PyereualJetwork is a GPU-accelerated machine learning library in Python for professionals and researchers. It features PLAN, MLP, Deep Learning training, and ENE (Eugenic NeuroEvolution) for genetic optimization, applicable to genetic algorithms or Reinforcement Learning (RL). The library includes data pre-processing, visualizations, model saving/loading, prediction, evaluation, training, and detailed or simplified memory management.
5
5
  Author: Hasan Can Beydili
6
6
  Author-email: tchasancan@gmail.com
@@ -1,27 +1,27 @@
1
- pyerualjetwork/__init__.py,sha256=83JqHyw4IH4Q7UYP7dEobblHD-olA-17hUNYtN9cQkU,3022
1
+ pyerualjetwork/__init__.py,sha256=S6a9ziYG2ZtpvF9O67Tdy4W0uAQSi3wb1NDGmnrXFFc,3020
2
2
  pyerualjetwork/ene.py,sha256=8g2XEPRm3NLqSaN7xihIj1xXdIjSrl8Q69zqWTIXPI4,42142
3
3
  pyerualjetwork/fitness_functions.py,sha256=D9JVCr9DFid_xXgBD4uCKxdW2k10MVDE5HZRSOK4Igg,1237
4
4
  pyerualjetwork/help.py,sha256=sn9jBzXkQsTZvdgsUXUpSs_BbYYIgY3whofg6dj8peI,848
5
5
  pyerualjetwork/issue_solver.py,sha256=uay_9XK6xWnLmK2P_BeyDQlyNXzg_zYffnXYd228wZk,4102
6
6
  pyerualjetwork/memory_ops.py,sha256=TUFh9SYWCKL6N-vNdWId_EwU313TuZomQCHOrltrD-4,14280
7
7
  pyerualjetwork/model_ops.py,sha256=39eUKrj0VKYiEYWKcq1U8O0TV_QMrxkuy8IhCHQsEcw,25101
8
- pyerualjetwork/nn.py,sha256=3r9lxrrUYwbrqx84AhflcPPvbaCwwkpnXF01g8s7v9w,36835
8
+ pyerualjetwork/nn.py,sha256=t1Jf99F6PqfEfCH6erPcwN6q-tF3DPYgHUlQ7OMtnv8,36656
9
9
  pyerualjetwork/old_cpu_model_ops.py,sha256=1KNgjUeYCO_TsA5RtbNiuIiBJzq8-rL2dE6jxKqCBU0,21481
10
10
  pyerualjetwork/old_cuda_model_ops.py,sha256=KAscAd8e_I8Vqdd9BJaHd6-IG6fhxFglAFxys0sqmEo,23079
11
11
  pyerualjetwork/ui.py,sha256=JBTFYz5R24XwNKhA3GSW-oYAoiIBxAE3kFGXkvm5gqw,656
12
12
  pyerualjetwork/cpu/__init__.py,sha256=9apRbPqvGKLJwyI3Md6R5a478YbZ7kIq0dRRa_lqgrY,789
13
13
  pyerualjetwork/cpu/activation_functions.py,sha256=zZSoOQ452Ykp_RsHVxklxesJmmFgufyIB4F3WQjudEQ,6689
14
- pyerualjetwork/cpu/data_ops.py,sha256=SPsIcjU0JPHfsnEmGjD8q-yTlpgYk-KPOPJ44dfp-nU,16143
14
+ pyerualjetwork/cpu/data_ops.py,sha256=9fCUrBmAc2WJQ3WkWEkDNSJyPdkkKsYX4rwSEy2TSvc,16108
15
15
  pyerualjetwork/cpu/loss_functions.py,sha256=6PyBI232SQRGuFnG3LDGvnv_PUdWzT2_2mUODJiejGI,618
16
16
  pyerualjetwork/cpu/metrics.py,sha256=NF8FARAqtuGlf4omVkQT4pOQZy7uePqzuHZGX9Y_Pn4,6076
17
17
  pyerualjetwork/cpu/visualizations.py,sha256=RcEZXX-U3BStOna1-C_a7z2VpXHuLAigeg1pD4u8I9I,26923
18
18
  pyerualjetwork/cuda/__init__.py,sha256=Kja6OmNaJ0giOhRNYw9hgGkh5N4F1EUS2v94E_rmp2k,839
19
19
  pyerualjetwork/cuda/activation_functions.py,sha256=Gj-qalU0GoAWoZzbFFHsD-R0c0KzHwOK1wwUQneBE44,6872
20
- pyerualjetwork/cuda/data_ops.py,sha256=k7NX-ckZ6-NwvioigACUHrekG7L5lO4bzTtQbBwH1Fc,18508
20
+ pyerualjetwork/cuda/data_ops.py,sha256=BEXh4M7BWXaTpYlVS9D2i3CGgOmL5131vy7FZyuTQBA,18453
21
21
  pyerualjetwork/cuda/loss_functions.py,sha256=C93IZJcrOpT6HMK9x1O4AHJWXYTkN5WZiqdssPbvAPk,617
22
22
  pyerualjetwork/cuda/metrics.py,sha256=PjDBoRvr6va8vRvDIJJGBO4-I4uumrk3NCM1Vz4NJTo,5054
23
23
  pyerualjetwork/cuda/visualizations.py,sha256=2mHE7iqqsN3K6xtCnemS4o_YWGS0bIV2IxF4cG6Ur9k,20090
24
- pyerualjetwork-5.47b0.dist-info/METADATA,sha256=-jbrSF5DZLdVFjMi80xETm6k8NKrbFPXgg0GW9ILqjc,7990
25
- pyerualjetwork-5.47b0.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
26
- pyerualjetwork-5.47b0.dist-info/top_level.txt,sha256=BRyt62U_r3ZmJpj-wXNOoA345Bzamrj6RbaWsyW4tRg,15
27
- pyerualjetwork-5.47b0.dist-info/RECORD,,
24
+ pyerualjetwork-5.48.dist-info/METADATA,sha256=QB4KoTEWk9oYD5Ypj--mwmszeP1Xm6yk8S1fuldxJec,7988
25
+ pyerualjetwork-5.48.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
26
+ pyerualjetwork-5.48.dist-info/top_level.txt,sha256=BRyt62U_r3ZmJpj-wXNOoA345Bzamrj6RbaWsyW4tRg,15
27
+ pyerualjetwork-5.48.dist-info/RECORD,,