pyerualjetwork 2.1.4__py3-none-any.whl → 2.1.6__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
@@ -1292,24 +1292,32 @@ def roc_curve(y_true, y_score):
1292
1292
  return fpr, tpr, thresholds
1293
1293
 
1294
1294
 
1295
- def confusion_matrix(y_true, y_pred, class_count):
1295
+ def confusion_matrix(y_true, y_pred, class_count=None):
1296
1296
  """
1297
1297
  Computes confusion matrix.
1298
1298
 
1299
1299
  Args:
1300
1300
  y_true (numpy.ndarray): True class labels (1D array).
1301
1301
  y_pred (numpy.ndarray): Predicted class labels (1D array).
1302
- num_classes (int): Number of classes.
1302
+ class_count (int, optional): Number of classes. If None, inferred from data.
1303
1303
 
1304
1304
  Returns:
1305
1305
  numpy.ndarray: Confusion matrix of shape (num_classes, num_classes).
1306
1306
  """
1307
+ if class_count is None:
1308
+ class_count = len(np.unique(np.concatenate((y_true, y_pred))))
1309
+
1307
1310
  confusion = np.zeros((class_count, class_count), dtype=int)
1308
1311
 
1309
1312
  for i in range(len(y_true)):
1310
1313
  true_label = y_true[i]
1311
1314
  pred_label = y_pred[i]
1312
- confusion[true_label, pred_label] += 1
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:
1318
+ confusion[true_label, pred_label] += 1
1319
+ else:
1320
+ print(f"Warning: Ignoring out of range label - True: {true_label}, Predicted: {pred_label}")
1313
1321
 
1314
1322
  return confusion
1315
1323
 
plan_di/plan_di.py CHANGED
@@ -1266,24 +1266,32 @@ 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):
1269
+ def confusion_matrix(y_true, y_pred, class_count=None):
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
- num_classes (int): Number of classes.
1276
+ class_count (int, optional): Number of classes. If None, inferred from data.
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
+
1281
1284
  confusion = np.zeros((class_count, class_count), dtype=int)
1282
1285
 
1283
1286
  for i in range(len(y_true)):
1284
1287
  true_label = y_true[i]
1285
1288
  pred_label = y_pred[i]
1286
- confusion[true_label, pred_label] += 1
1289
+
1290
+ # Ensure that true_label and pred_label are within the correct range
1291
+ if 0 <= true_label < class_count and 0 <= pred_label < class_count:
1292
+ confusion[true_label, pred_label] += 1
1293
+ else:
1294
+ print(f"Warning: Ignoring out of range label - True: {true_label}, Predicted: {pred_label}")
1287
1295
 
1288
1296
  return confusion
1289
1297
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyerualjetwork
3
- Version: 2.1.4
3
+ Version: 2.1.6
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=mfBNSNqoTtXKvPZNCZuNYkVJnkOmg1JpM2FsLhE0nak,47203
3
+ plan_di/__init__.py,sha256=Eut7tVtvQaczEejYyqfQ4eqF71j69josJcY91WN_dkk,508
4
+ plan_di/plan_di.py,sha256=fiaYet8F6N1ad3xIvzLwgUZwridxuc-i03cZifoyJfc,44581
5
+ pyerualjetwork-2.1.6.dist-info/METADATA,sha256=T2M8jWa5LYTkdXcTrzmoHOKVeGdVdgrf_1UXaomsOw4,457
6
+ pyerualjetwork-2.1.6.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
7
+ pyerualjetwork-2.1.6.dist-info/top_level.txt,sha256=aaXSOcnD62fbXG1x7tw4nV50Qxx9g9zDNLK7OD4BdPE,16
8
+ pyerualjetwork-2.1.6.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- plan_bi/__init__.py,sha256=82q8bWRYqzwMrFuViQzBg7P19i6EqdV7VYBVxuQ-LV0,517
2
- plan_bi/plan_bi.py,sha256=x4f7TiAPCSVGMj9M0oqHppPaDpnqhIXmtaQoY9l35Ys,46766
3
- plan_di/__init__.py,sha256=Eut7tVtvQaczEejYyqfQ4eqF71j69josJcY91WN_dkk,508
4
- plan_di/plan_di.py,sha256=3eOfR-14uvqfyv26q3SB9DJI0fubp0kgXSazAmhbXo4,44144
5
- pyerualjetwork-2.1.4.dist-info/METADATA,sha256=kLBLKu0TUhWmCml5bqtDWMceg3GIDsfR48rttmrC8Qo,457
6
- pyerualjetwork-2.1.4.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
7
- pyerualjetwork-2.1.4.dist-info/top_level.txt,sha256=aaXSOcnD62fbXG1x7tw4nV50Qxx9g9zDNLK7OD4BdPE,16
8
- pyerualjetwork-2.1.4.dist-info/RECORD,,