pyerualjetwork 2.3.7__py3-none-any.whl → 2.3.9__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.
plan_bi/plan_bi.py CHANGED
@@ -17,6 +17,7 @@ def fit(
17
17
  x_train: List[Union[int, float]],
18
18
  y_train: List[Union[int, float, str]], # At least two.. and one hot encoded
19
19
  activation_potential: Union[float],
20
+ show_training
20
21
  ) -> str:
21
22
 
22
23
  infoPLAN = """
@@ -26,6 +27,7 @@ def fit(
26
27
  x_train (list[num]): List of input data.
27
28
  y_train (list[num]): List of y_train. (one hot encoded)
28
29
  activation_potential (float): Input activation potential
30
+ show_training (bool, str): True, None or 'final'
29
31
 
30
32
  Returns:
31
33
  list([num]): (Weight matrices list, train_predictions list, Train_acc).
@@ -85,6 +87,34 @@ def fit(
85
87
 
86
88
  for i, w in enumerate(W):
87
89
  trained_W[i] = trained_W[i] + w
90
+
91
+ if show_training == True:
92
+
93
+ fig, ax = plt.subplots(1, 10, figsize=(18, 14))
94
+
95
+ try:
96
+ row = x_train[1].shape[0]
97
+ col = x_train[1].shape[1]
98
+ except:
99
+ print(Fore.RED + 'ERROR: You try train showing but inputs is raveled. x_train inputs to must be reshape for training_show.', infoPLAN + Style.RESET_ALL)
100
+ return 'e'
101
+
102
+ for j in range(10):
103
+
104
+
105
+ mat = trained_W[0][j,:].reshape(row, col)
106
+
107
+
108
+
109
+ ax[j].imshow(mat, interpolation='sinc', cmap='viridis')
110
+ ax[j].set_aspect('equal')
111
+
112
+ ax[j].set_xticks([])
113
+ ax[j].set_yticks([])
114
+ ax[j].set_title(f'{j+1}. Neuron')
115
+
116
+
117
+ plt.show()
88
118
 
89
119
 
90
120
  W = weight_identification(len(layers) - 1, len(class_count), neurons, x_train_size)
@@ -1338,7 +1368,7 @@ def plot_evaluate(y_test, y_preds, acc_list):
1338
1368
  axs[0, 1].set_ylim(0, 1) # Y eksenini 0 ile 1 arasında sınırla
1339
1369
  axs[0, 1].set_xlabel('Metrics')
1340
1370
  axs[0, 1].set_ylabel('Score')
1341
- axs[0, 1].set_title('Precision, Recall, F1 Score, and Accuracy (Wighted)')
1371
+ axs[0, 1].set_title('Precision, Recall, F1 Score, and Accuracy (Weighted)')
1342
1372
  axs[0, 1].grid(True, axis='y', linestyle='--', alpha=0.7)
1343
1373
 
1344
1374
  # Accuracy
plan_di/plan_di.py CHANGED
@@ -21,7 +21,8 @@ import seaborn as sns
21
21
  def fit(
22
22
  x_train: List[Union[int, float]],
23
23
  # At least two.. and one hot encoded
24
- y_train: List[Union[int, float, str]],
24
+ y_train: List[Union[int, float, str]], # At least two.. and one hot encoded
25
+ show_training
25
26
  ) -> str:
26
27
 
27
28
  infoPLAN = """
@@ -30,7 +31,7 @@ def fit(
30
31
  Args:
31
32
  x_train (list[num]): List of input data.
32
33
  y_train (list[num]): List of y_train. (one hot encoded)
33
- activation_potential (float): Input activation potential
34
+ show_training (bool, str): True, None or 'final'
34
35
 
35
36
  Returns:
36
37
  list([num]): (Weight matrices list, train_predictions list, Train_acc).
@@ -57,13 +58,14 @@ def fit(
57
58
  x_train[0] = x_train[0].ravel()
58
59
  x_train_size = len(x_train[0])
59
60
 
60
- W = weight_identification(
61
+ W = pdi.weight_identification(
61
62
  len(layers) - 1, len(class_count), neurons, x_train_size)
62
63
 
63
64
  trained_W = [1] * len(W)
64
65
  print(Fore.GREEN + "Train Started with 0 ERROR" + Style.RESET_ALL)
65
66
  start_time = time.time()
66
- y = decode_one_hot(y_train)
67
+ y = pdi.decode_one_hot(y_train)
68
+
67
69
  for index, inp in enumerate(x_train):
68
70
  uni_start_time = time.time()
69
71
  inp = np.array(inp)
@@ -78,15 +80,40 @@ def fit(
78
80
 
79
81
  for Lindex, Layer in enumerate(layers):
80
82
 
81
- neural_layer = normalization(neural_layer)
83
+ neural_layer = pdi.normalization(neural_layer)
82
84
 
83
85
  if Layer == 'fex':
84
- W[Lindex] = fex(neural_layer, W[Lindex], True, y[index])
86
+ W[Lindex] = pdi.fex(neural_layer, W[Lindex], True, y[index])
85
87
 
86
88
  for i, w in enumerate(W):
87
89
  trained_W[i] = trained_W[i] + w
88
90
 
89
- W = weight_identification(
91
+ if show_training == True:
92
+
93
+ fig, ax = plt.subplots(1, 10, figsize=(18, 14))
94
+
95
+ try:
96
+ row = x_train[1].shape[0]
97
+ col = x_train[1].shape[1]
98
+ except:
99
+ print(Fore.RED + 'ERROR: You try train showing but inputs is raveled. x_train inputs to must be reshape for training_show.', infoPLAN + Style.RESET_ALL)
100
+ return 'e'
101
+
102
+ for j in range(10):
103
+
104
+ mat = trained_W[0][j,:].reshape(row, col)
105
+
106
+ ax[j].imshow(mat, interpolation='sinc', cmap='viridis')
107
+ ax[j].set_aspect('equal')
108
+
109
+ ax[j].set_xticks([])
110
+ ax[j].set_yticks([])
111
+ ax[j].set_title(f'{j+1}. Neuron')
112
+
113
+
114
+ plt.show()
115
+
116
+ W = pdi.weight_identification(
90
117
  len(layers) - 1, len(class_count), neurons, x_train_size)
91
118
 
92
119
  uni_end_time = time.time()
@@ -105,6 +132,31 @@ def fit(
105
132
 
106
133
  print('\rTraining: ', index, "/", len(x_train), "\n", end="")
107
134
 
135
+ if show_training == 'final':
136
+
137
+ fig, ax = plt.subplots(1, 10, figsize=(18, 14))
138
+
139
+ try:
140
+ row = x_train[1].shape[0]
141
+ col = x_train[1].shape[1]
142
+ except:
143
+ print(Fore.RED + 'ERROR: You try train showing but inputs is raveled. x_train inputs to must be reshape for training_show.', infoPLAN + Style.RESET_ALL)
144
+ return 'e'
145
+
146
+ for j in range(10):
147
+
148
+ mat = trained_W[0][j,:].reshape(row, col)
149
+
150
+ ax[j].imshow(mat, interpolation='sinc', cmap='viridis')
151
+ ax[j].set_aspect('equal')
152
+
153
+ ax[j].set_xticks([])
154
+ ax[j].set_yticks([])
155
+ ax[j].set_title(f'{j+1}. Neuron')
156
+
157
+
158
+ plt.show()
159
+
108
160
  EndTime = time.time()
109
161
 
110
162
  calculating_est = round(EndTime - start_time, 2)
@@ -1310,7 +1362,7 @@ def plot_evaluate(y_test, y_preds, acc_list):
1310
1362
  axs[0, 1].set_ylim(0, 1) # Y eksenini 0 ile 1 arasında sınırla
1311
1363
  axs[0, 1].set_xlabel('Metrics')
1312
1364
  axs[0, 1].set_ylabel('Score')
1313
- axs[0, 1].set_title('Precision, Recall, F1 Score, and Accuracy (Wighted)')
1365
+ axs[0, 1].set_title('Precision, Recall, F1 Score, and Accuracy (Weighted)')
1314
1366
  axs[0, 1].grid(True, axis='y', linestyle='--', alpha=0.7)
1315
1367
 
1316
1368
  # Accuracy
@@ -0,0 +1,8 @@
1
+ Metadata-Version: 2.1
2
+ Name: pyerualjetwork
3
+ Version: 2.3.9
4
+ Summary: show_training parameter added for fit function[True, 'final' or any]. Code improvements
5
+ Author: Hasan Can Beydili
6
+ Author-email: tchasancan@gmail.com
7
+ Keywords: model evaluation,classifcation,pruning learning artficial neural networks
8
+
@@ -0,0 +1,8 @@
1
+ plan_bi/__init__.py,sha256=kHnuGDOKyMHQqeX49ToUUsdZckh9RPuyADhYw0SrmIo,514
2
+ plan_bi/plan_bi.py,sha256=qGk5ukjsDeefW4oEDK4QfJ46rIkLzJitxQ8PhPGBPIA,51828
3
+ plan_di/__init__.py,sha256=DJzUsYj-tgbeewoGz-K9nfGsKqrRFUxIr_z-NgqySBk,505
4
+ plan_di/plan_di.py,sha256=LAAemI6Pjxrx_SV3zdeMfgaPMBLSW5iUjHm9vCqTw6I,49968
5
+ pyerualjetwork-2.3.9.dist-info/METADATA,sha256=z65Y8v0c26bKCxqe9mQkBjGDKCs4oP1lbcyiUxbuE_4,309
6
+ pyerualjetwork-2.3.9.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
7
+ pyerualjetwork-2.3.9.dist-info/top_level.txt,sha256=aaXSOcnD62fbXG1x7tw4nV50Qxx9g9zDNLK7OD4BdPE,16
8
+ pyerualjetwork-2.3.9.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: pyerualjetwork
3
- Version: 2.3.7
4
- Summary: Weights post process function added: [weight_post_process](optional after training before testing.), new function: manuel_balancer. And scaler_params added for scaled models.
5
- Author: Hasan Can Beydili
6
- Author-email: tchasancan@gmail.com
7
- Keywords: model evaluation,classifcation,pruning learning artficial neural networks
8
-
@@ -1,8 +0,0 @@
1
- plan_bi/__init__.py,sha256=kHnuGDOKyMHQqeX49ToUUsdZckh9RPuyADhYw0SrmIo,514
2
- plan_bi/plan_bi.py,sha256=ah3ezPLFeeXTSPnejzIxB_nmfTYNY7-80ECKQGVjudE,50579
3
- plan_di/__init__.py,sha256=DJzUsYj-tgbeewoGz-K9nfGsKqrRFUxIr_z-NgqySBk,505
4
- plan_di/plan_di.py,sha256=L7yqB7xDPxARzM-W05qVZKbrmzPcE8cRV8xlEfFV3i4,47971
5
- pyerualjetwork-2.3.7.dist-info/METADATA,sha256=pfb39dXHH3Zj0q6DAN2g2WyX3LV3SljVGl24sHp9ejs,396
6
- pyerualjetwork-2.3.7.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
7
- pyerualjetwork-2.3.7.dist-info/top_level.txt,sha256=aaXSOcnD62fbXG1x7tw4nV50Qxx9g9zDNLK7OD4BdPE,16
8
- pyerualjetwork-2.3.7.dist-info/RECORD,,