pyerualjetwork 2.1.5__tar.gz → 2.1.7__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyerualjetwork
3
- Version: 2.1.5
3
+ Version: 2.1.7
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
@@ -1306,14 +1306,18 @@ def confusion_matrix(y_true, y_pred, class_count=None):
1306
1306
  """
1307
1307
  if class_count is None:
1308
1308
  class_count = len(np.unique(np.concatenate((y_true, y_pred))))
1309
-
1309
+
1310
1310
  confusion = np.zeros((class_count, class_count), dtype=int)
1311
1311
 
1312
1312
  for i in range(len(y_true)):
1313
1313
  true_label = y_true[i]
1314
1314
  pred_label = y_pred[i]
1315
- if true_label < class_count and pred_label < class_count:
1315
+
1316
+ # Ensure that true_label and pred_label are within the correct range
1317
+ if 0 <= true_label < class_count and 0 <= pred_label < class_count:
1316
1318
  confusion[true_label, pred_label] += 1
1319
+ else:
1320
+ print(f"Warning: Ignoring out of range label - True: {true_label}, Predicted: {pred_label}")
1317
1321
 
1318
1322
  return confusion
1319
1323
 
@@ -1327,7 +1331,7 @@ def plot_evaluate(y_test, y_preds, acc_list):
1327
1331
  y_preds = np.array(y_preds)
1328
1332
  fpr, tpr, thresholds = roc_curve(y_true, y_preds)
1329
1333
  precision, recall, f1 = metrics(y_test, y_preds)
1330
- Class = np.unique(y_test)
1334
+ Class = np.unique(decode_one_hot(y_test))
1331
1335
 
1332
1336
 
1333
1337
  cm = confusion_matrix(y_true, y_preds, len(Class))
@@ -1266,28 +1266,24 @@ def roc_curve(y_true, y_score):
1266
1266
  return fpr, tpr, thresholds
1267
1267
 
1268
1268
 
1269
- def confusion_matrix(y_true, y_pred, class_count=None):
1269
+ def confusion_matrix(y_true, y_pred, class_count):
1270
1270
  """
1271
1271
  Computes confusion matrix.
1272
1272
 
1273
1273
  Args:
1274
1274
  y_true (numpy.ndarray): True class labels (1D array).
1275
1275
  y_pred (numpy.ndarray): Predicted class labels (1D array).
1276
- class_count (int, optional): Number of classes. If None, inferred from data.
1276
+ num_classes (int): Number of classes.
1277
1277
 
1278
1278
  Returns:
1279
1279
  numpy.ndarray: Confusion matrix of shape (num_classes, num_classes).
1280
1280
  """
1281
- if class_count is None:
1282
- class_count = len(np.unique(np.concatenate((y_true, y_pred))))
1283
-
1284
1281
  confusion = np.zeros((class_count, class_count), dtype=int)
1285
1282
 
1286
1283
  for i in range(len(y_true)):
1287
1284
  true_label = y_true[i]
1288
1285
  pred_label = y_pred[i]
1289
- if true_label < class_count and pred_label < class_count:
1290
- confusion[true_label, pred_label] += 1
1286
+ confusion[true_label, pred_label] += 1
1291
1287
 
1292
1288
  return confusion
1293
1289
 
@@ -1301,7 +1297,7 @@ def plot_evaluate(y_test, y_preds, acc_list):
1301
1297
  y_preds = np.array(y_preds)
1302
1298
  fpr, tpr, thresholds = roc_curve(y_true, y_preds)
1303
1299
  precision, recall, f1 = metrics(y_test, y_preds)
1304
- Class = np.unique(y_test)
1300
+ Class = np.unique(decode_one_hot(y_test))
1305
1301
 
1306
1302
  # Confusion matrix
1307
1303
  cm = confusion_matrix(y_true, y_preds, len(Class))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyerualjetwork
3
- Version: 2.1.5
3
+ Version: 2.1.7
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
@@ -5,7 +5,7 @@ from setuptools import setup, find_packages
5
5
  setup(
6
6
 
7
7
  name = "pyerualjetwork",
8
- version = "2.1.5",
8
+ version = "2.1.7",
9
9
  author = "Hasan Can Beydili",
10
10
  author_email = "tchasancan@gmail.com",
11
11
  description= " 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)",
File without changes