pyerualjetwork 2.1.8__py3-none-any.whl → 2.1.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 +44 -22
- plan_di/plan_di.py +35 -13
- {pyerualjetwork-2.1.8.dist-info → pyerualjetwork-2.1.9.dist-info}/METADATA +1 -1
- pyerualjetwork-2.1.9.dist-info/RECORD +8 -0
- pyerualjetwork-2.1.8.dist-info/RECORD +0 -8
- {pyerualjetwork-2.1.8.dist-info → pyerualjetwork-2.1.9.dist-info}/WHEEL +0 -0
- {pyerualjetwork-2.1.8.dist-info → pyerualjetwork-2.1.9.dist-info}/top_level.txt +0 -0
plan_bi/plan_bi.py
CHANGED
@@ -1348,13 +1348,14 @@ def plot_evaluate(y_test, y_preds, acc_list):
|
|
1348
1348
|
|
1349
1349
|
y_true = np.array(y_true)
|
1350
1350
|
y_preds = np.array(y_preds)
|
1351
|
-
fpr, tpr, thresholds = roc_curve(y_true, y_preds)
|
1352
|
-
precision, recall, f1 = metrics(y_test, y_preds)
|
1353
1351
|
Class = np.unique(decode_one_hot(y_test))
|
1352
|
+
|
1353
|
+
precision, recall, f1 = metrics(y_test, y_preds)
|
1354
1354
|
|
1355
|
-
|
1356
|
-
cm = confusion_matrix(y_true, y_preds, len(Class))
|
1357
1355
|
|
1356
|
+
# Confusion matrix
|
1357
|
+
cm = confusion_matrix(y_true, y_preds, len(Class))
|
1358
|
+
# Subplot içinde düzenleme
|
1358
1359
|
fig, axs = plt.subplots(2, 2, figsize=(16, 12))
|
1359
1360
|
|
1360
1361
|
# Confusion Matrix
|
@@ -1363,51 +1364,72 @@ def plot_evaluate(y_test, y_preds, acc_list):
|
|
1363
1364
|
axs[0, 0].set_xlabel("Predicted Class")
|
1364
1365
|
axs[0, 0].set_ylabel("Actual Class")
|
1365
1366
|
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1367
|
+
if len(Class) == 2:
|
1368
|
+
fpr, tpr, thresholds = roc_curve(y_true, y_preds)
|
1369
|
+
# ROC Curve
|
1370
|
+
roc_auc = np.trapz(tpr, fpr)
|
1371
|
+
axs[1, 0].plot(fpr, tpr, color='darkorange', lw=2, label=f'ROC curve (area = {roc_auc:.2f})')
|
1372
|
+
axs[1, 0].plot([0, 1], [0, 1], color='navy', lw=2, linestyle='--')
|
1373
|
+
axs[1, 0].set_xlim([0.0, 1.0])
|
1374
|
+
axs[1, 0].set_ylim([0.0, 1.05])
|
1375
|
+
axs[1, 0].set_xlabel('False Positive Rate')
|
1376
|
+
axs[1, 0].set_ylabel('True Positive Rate')
|
1377
|
+
axs[1, 0].set_title('Receiver Operating Characteristic (ROC) Curve')
|
1378
|
+
axs[1, 0].legend(loc="lower right")
|
1379
|
+
axs[1, 0].legend(loc="lower right")
|
1380
|
+
else:
|
1381
|
+
accuracy_per_class = []
|
1382
|
+
|
1383
|
+
for cls in Class:
|
1384
|
+
correct = np.sum((y_true == cls) & (y_preds == cls))
|
1385
|
+
total = np.sum(y_true == cls)
|
1386
|
+
accuracy_cls = correct / total if total > 0 else 0.0
|
1387
|
+
accuracy_per_class.append(accuracy_cls)
|
1388
|
+
|
1389
|
+
axs[1, 0].bar(Class, accuracy_per_class, color='b', alpha=0.7)
|
1390
|
+
axs[1, 0].set_xlabel('Class')
|
1391
|
+
axs[1, 0].set_ylabel('Accuracy')
|
1392
|
+
axs[1, 0].set_title('Class-wise Accuracy')
|
1393
|
+
axs[1, 0].set_xticks(Class)
|
1394
|
+
axs[1, 0].grid(True)
|
1395
|
+
|
1396
|
+
|
1397
|
+
|
1398
|
+
|
1377
1399
|
|
1378
1400
|
# Precision, Recall, F1 Score, Accuracy
|
1379
1401
|
metric = ['Precision', 'Recall', 'F1 Score', 'Accuracy']
|
1380
1402
|
values = [precision, recall, f1, acc]
|
1381
1403
|
colors = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728']
|
1382
1404
|
|
1383
|
-
|
1405
|
+
#
|
1384
1406
|
bars = axs[0, 1].bar(metric, values, color=colors)
|
1385
1407
|
|
1386
|
-
|
1408
|
+
|
1387
1409
|
for bar, value in zip(bars, values):
|
1388
1410
|
axs[0, 1].text(bar.get_x() + bar.get_width() / 2, bar.get_height() - 0.05, f'{value:.2f}',
|
1389
1411
|
ha='center', va='bottom', fontsize=12, color='white', weight='bold')
|
1390
1412
|
|
1391
|
-
axs[0, 1].set_ylim(0, 1)
|
1413
|
+
axs[0, 1].set_ylim(0, 1) # Y eksenini 0 ile 1 arasında sınırla
|
1392
1414
|
axs[0, 1].set_xlabel('Metrics')
|
1393
1415
|
axs[0, 1].set_ylabel('Score')
|
1394
1416
|
axs[0, 1].set_title('Precision, Recall, F1 Score, and Accuracy')
|
1395
1417
|
axs[0, 1].grid(True, axis='y', linestyle='--', alpha=0.7)
|
1396
1418
|
|
1397
|
-
|
1419
|
+
# Accuracy
|
1398
1420
|
plt.plot(acc_list, marker='o', linestyle='-',
|
1399
1421
|
color='r', label='Accuracy')
|
1400
1422
|
|
1401
|
-
|
1423
|
+
|
1402
1424
|
plt.axhline(y=1, color='g', linestyle='--', label='Maximum Accuracy')
|
1403
1425
|
|
1404
|
-
|
1426
|
+
|
1405
1427
|
plt.xlabel('Samples')
|
1406
1428
|
plt.ylabel('Accuracy')
|
1407
1429
|
plt.title('Accuracy History')
|
1408
1430
|
plt.legend()
|
1409
1431
|
|
1410
|
-
|
1432
|
+
|
1411
1433
|
plt.tight_layout()
|
1412
1434
|
plt.show()
|
1413
1435
|
|
plan_di/plan_di.py
CHANGED
@@ -1315,9 +1315,10 @@ def plot_evaluate(y_test, y_preds, acc_list):
|
|
1315
1315
|
|
1316
1316
|
y_true = np.array(y_true)
|
1317
1317
|
y_preds = np.array(y_preds)
|
1318
|
-
fpr, tpr, thresholds = roc_curve(y_true, y_preds)
|
1319
|
-
precision, recall, f1 = metrics(y_test, y_preds)
|
1320
1318
|
Class = np.unique(decode_one_hot(y_test))
|
1319
|
+
|
1320
|
+
precision, recall, f1 = metrics(y_test, y_preds)
|
1321
|
+
|
1321
1322
|
|
1322
1323
|
# Confusion matrix
|
1323
1324
|
cm = confusion_matrix(y_true, y_preds, len(Class))
|
@@ -1330,17 +1331,38 @@ def plot_evaluate(y_test, y_preds, acc_list):
|
|
1330
1331
|
axs[0, 0].set_xlabel("Predicted Class")
|
1331
1332
|
axs[0, 0].set_ylabel("Actual Class")
|
1332
1333
|
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1334
|
+
if len(Class) == 2:
|
1335
|
+
fpr, tpr, thresholds = roc_curve(y_true, y_preds)
|
1336
|
+
# ROC Curve
|
1337
|
+
roc_auc = np.trapz(tpr, fpr)
|
1338
|
+
axs[1, 0].plot(fpr, tpr, color='darkorange', lw=2, label=f'ROC curve (area = {roc_auc:.2f})')
|
1339
|
+
axs[1, 0].plot([0, 1], [0, 1], color='navy', lw=2, linestyle='--')
|
1340
|
+
axs[1, 0].set_xlim([0.0, 1.0])
|
1341
|
+
axs[1, 0].set_ylim([0.0, 1.05])
|
1342
|
+
axs[1, 0].set_xlabel('False Positive Rate')
|
1343
|
+
axs[1, 0].set_ylabel('True Positive Rate')
|
1344
|
+
axs[1, 0].set_title('Receiver Operating Characteristic (ROC) Curve')
|
1345
|
+
axs[1, 0].legend(loc="lower right")
|
1346
|
+
axs[1, 0].legend(loc="lower right")
|
1347
|
+
else:
|
1348
|
+
accuracy_per_class = []
|
1349
|
+
|
1350
|
+
for cls in Class:
|
1351
|
+
correct = np.sum((y_true == cls) & (y_preds == cls))
|
1352
|
+
total = np.sum(y_true == cls)
|
1353
|
+
accuracy_cls = correct / total if total > 0 else 0.0
|
1354
|
+
accuracy_per_class.append(accuracy_cls)
|
1355
|
+
|
1356
|
+
axs[1, 0].bar(Class, accuracy_per_class, color='b', alpha=0.7)
|
1357
|
+
axs[1, 0].set_xlabel('Class')
|
1358
|
+
axs[1, 0].set_ylabel('Accuracy')
|
1359
|
+
axs[1, 0].set_title('Class-wise Accuracy')
|
1360
|
+
axs[1, 0].set_xticks(Class)
|
1361
|
+
axs[1, 0].grid(True)
|
1362
|
+
|
1363
|
+
|
1364
|
+
|
1365
|
+
|
1344
1366
|
|
1345
1367
|
# Precision, Recall, F1 Score, Accuracy
|
1346
1368
|
metric = ['Precision', 'Recall', 'F1 Score', 'Accuracy']
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pyerualjetwork
|
3
|
-
Version: 2.1.
|
3
|
+
Version: 2.1.9
|
4
4
|
Summary: 8 new functions: multiple_evaluate , encode_one_hot, split, metrics, decode_one_hot, roc_curve, confusion_matrix, plot_evaluate And Code improvements (Documentation in desc. Examples in GİTHUB: https://github.com/HCB06/PyerualJetwork)
|
5
5
|
Author: Hasan Can Beydili
|
6
6
|
Author-email: tchasancan@gmail.com
|
@@ -0,0 +1,8 @@
|
|
1
|
+
plan_bi/__init__.py,sha256=82q8bWRYqzwMrFuViQzBg7P19i6EqdV7VYBVxuQ-LV0,517
|
2
|
+
plan_bi/plan_bi.py,sha256=5lzUpnRV5hKhSsErqojShC9jtJ0Uy83Two90jmKOvZk,48701
|
3
|
+
plan_di/__init__.py,sha256=Eut7tVtvQaczEejYyqfQ4eqF71j69josJcY91WN_dkk,508
|
4
|
+
plan_di/plan_di.py,sha256=LYfuCW2KkzP-rACl4jt9zTry96-L-nSOJSf1tS9pXr0,45451
|
5
|
+
pyerualjetwork-2.1.9.dist-info/METADATA,sha256=QrFkTmYHTP1coZUcEoB8iKxsCXe-njXxheq_6d4JBJc,457
|
6
|
+
pyerualjetwork-2.1.9.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
7
|
+
pyerualjetwork-2.1.9.dist-info/top_level.txt,sha256=aaXSOcnD62fbXG1x7tw4nV50Qxx9g9zDNLK7OD4BdPE,16
|
8
|
+
pyerualjetwork-2.1.9.dist-info/RECORD,,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
plan_bi/__init__.py,sha256=82q8bWRYqzwMrFuViQzBg7P19i6EqdV7VYBVxuQ-LV0,517
|
2
|
-
plan_bi/plan_bi.py,sha256=X07a6h4lsujU6ZOr5jvYJ8SHnqF-pZv0rC1NdqDIn2g,47912
|
3
|
-
plan_di/__init__.py,sha256=Eut7tVtvQaczEejYyqfQ4eqF71j69josJcY91WN_dkk,508
|
4
|
-
plan_di/plan_di.py,sha256=nnxUtyl2IZsriO0XPG15zFFsKnrMt0idQ9aGX4wCZ0M,44779
|
5
|
-
pyerualjetwork-2.1.8.dist-info/METADATA,sha256=m7n0aG1mKt7J9QFBIc7A8zoTZytqVVY3aqEZuO_0Z4c,457
|
6
|
-
pyerualjetwork-2.1.8.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
7
|
-
pyerualjetwork-2.1.8.dist-info/top_level.txt,sha256=aaXSOcnD62fbXG1x7tw4nV50Qxx9g9zDNLK7OD4BdPE,16
|
8
|
-
pyerualjetwork-2.1.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|