ddi-fw 0.0.212__tar.gz → 0.0.214__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.
Files changed (111) hide show
  1. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/PKG-INFO +1 -1
  2. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/pyproject.toml +1 -1
  3. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/ml/ml_helper.py +1 -1
  4. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/ml/tensorflow_wrapper.py +3 -3
  5. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/utils/__init__.py +1 -1
  6. ddi_fw-0.0.214/src/ddi_fw/utils/categorical_data_encoding_checker.py +90 -0
  7. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw.egg-info/PKG-INFO +1 -1
  8. ddi_fw-0.0.212/src/ddi_fw/utils/categorical_data_encoding_checker.py +0 -44
  9. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/README.md +0 -0
  10. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/setup.cfg +0 -0
  11. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/__init__.py +0 -0
  12. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/core.py +0 -0
  13. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/dataset_splitter.py +0 -0
  14. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/db_utils.py +0 -0
  15. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/base.py +0 -0
  16. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/data/event.db +0 -0
  17. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/debug.log +0 -0
  18. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes/test_indexes.txt +0 -0
  19. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes/train_fold_0.txt +0 -0
  20. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes/train_fold_1.txt +0 -0
  21. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes/train_fold_2.txt +0 -0
  22. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes/train_fold_3.txt +0 -0
  23. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes/train_fold_4.txt +0 -0
  24. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes/train_indexes.txt +0 -0
  25. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes/validation_fold_0.txt +0 -0
  26. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes/validation_fold_1.txt +0 -0
  27. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes/validation_fold_2.txt +0 -0
  28. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes/validation_fold_3.txt +0 -0
  29. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes/validation_fold_4.txt +0 -0
  30. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes_old/test_indexes.txt +0 -0
  31. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes_old/train_fold_0.txt +0 -0
  32. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes_old/train_fold_1.txt +0 -0
  33. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes_old/train_fold_2.txt +0 -0
  34. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes_old/train_fold_3.txt +0 -0
  35. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes_old/train_fold_4.txt +0 -0
  36. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes_old/train_indexes.txt +0 -0
  37. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes_old/validation_fold_0.txt +0 -0
  38. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes_old/validation_fold_1.txt +0 -0
  39. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes_old/validation_fold_2.txt +0 -0
  40. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes_old/validation_fold_3.txt +0 -0
  41. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/indexes_old/validation_fold_4.txt +0 -0
  42. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl/readme.md +0 -0
  43. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl_text/base.py +0 -0
  44. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl_text/data/event.db +0 -0
  45. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl_text/indexes/test_indexes.txt +0 -0
  46. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl_text/indexes/train_fold_0.txt +0 -0
  47. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl_text/indexes/train_fold_1.txt +0 -0
  48. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl_text/indexes/train_fold_2.txt +0 -0
  49. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl_text/indexes/train_fold_3.txt +0 -0
  50. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl_text/indexes/train_fold_4.txt +0 -0
  51. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl_text/indexes/train_indexes.txt +0 -0
  52. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl_text/indexes/validation_fold_0.txt +0 -0
  53. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl_text/indexes/validation_fold_1.txt +0 -0
  54. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl_text/indexes/validation_fold_2.txt +0 -0
  55. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl_text/indexes/validation_fold_3.txt +0 -0
  56. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/ddi_mdl_text/indexes/validation_fold_4.txt +0 -0
  57. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/mdf_sa_ddi/__init__.py +0 -0
  58. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/mdf_sa_ddi/base.py +0 -0
  59. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/mdf_sa_ddi/df_extraction_cleanxiaoyu50.csv +0 -0
  60. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/mdf_sa_ddi/drug_information_del_noDDIxiaoyu50.csv +0 -0
  61. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/mdf_sa_ddi/indexes/test_indexes.txt +0 -0
  62. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/mdf_sa_ddi/indexes/train_fold_0.txt +0 -0
  63. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/mdf_sa_ddi/indexes/train_fold_1.txt +0 -0
  64. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/mdf_sa_ddi/indexes/train_fold_2.txt +0 -0
  65. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/mdf_sa_ddi/indexes/train_fold_3.txt +0 -0
  66. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/mdf_sa_ddi/indexes/train_fold_4.txt +0 -0
  67. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/mdf_sa_ddi/indexes/train_indexes.txt +0 -0
  68. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/mdf_sa_ddi/indexes/validation_fold_0.txt +0 -0
  69. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/mdf_sa_ddi/indexes/validation_fold_1.txt +0 -0
  70. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/mdf_sa_ddi/indexes/validation_fold_2.txt +0 -0
  71. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/mdf_sa_ddi/indexes/validation_fold_3.txt +0 -0
  72. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/mdf_sa_ddi/indexes/validation_fold_4.txt +0 -0
  73. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/mdf_sa_ddi/mdf-sa-ddi.zip +0 -0
  74. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/datasets/setup_._py +0 -0
  75. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/drugbank/__init__.py +0 -0
  76. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/drugbank/drugbank.xsd +0 -0
  77. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/drugbank/drugbank_parser.py +0 -0
  78. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/drugbank/drugbank_processor.py +0 -0
  79. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/drugbank/drugbank_processor_org.py +0 -0
  80. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/drugbank/event_extractor.py +0 -0
  81. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/langchain/__init__.py +0 -0
  82. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/langchain/embeddings.py +0 -0
  83. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/langchain/sentence_splitter.py +0 -0
  84. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/langchain/storage.py +0 -0
  85. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/ml/__init__.py +0 -0
  86. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/ml/evaluation_helper.py +0 -0
  87. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/ml/model_wrapper.py +0 -0
  88. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/ml/pytorch_wrapper.py +0 -0
  89. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/ner/__init__.py +0 -0
  90. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/ner/mmlrestclient.py +0 -0
  91. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/ner/ner.py +0 -0
  92. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/pipeline/__init__.py +0 -0
  93. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/pipeline/multi_modal_combination_strategy.py +0 -0
  94. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/pipeline/multi_pipeline.py +0 -0
  95. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/pipeline/ner_pipeline.py +0 -0
  96. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/pipeline/pipeline.py +0 -0
  97. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/utils/enums.py +0 -0
  98. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/utils/json_helper.py +0 -0
  99. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/utils/kaggle.py +0 -0
  100. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/utils/numpy_utils.py +0 -0
  101. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/utils/package_helper.py +0 -0
  102. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/utils/py7zr_helper.py +0 -0
  103. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/utils/utils.py +0 -0
  104. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/utils/zip_helper.py +0 -0
  105. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/vectorization/__init__.py +0 -0
  106. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/vectorization/feature_vector_generation.py +0 -0
  107. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw/vectorization/idf_helper.py +0 -0
  108. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw.egg-info/SOURCES.txt +0 -0
  109. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw.egg-info/dependency_links.txt +0 -0
  110. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw.egg-info/requires.txt +0 -0
  111. {ddi_fw-0.0.212 → ddi_fw-0.0.214}/src/ddi_fw.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ddi_fw
3
- Version: 0.0.212
3
+ Version: 0.0.214
4
4
  Summary: Do not use :)
5
5
  Author-email: Kıvanç Bayraktar <bayraktarkivanc@gmail.com>
6
6
  Maintainer-email: Kıvanç Bayraktar <bayraktarkivanc@gmail.com>
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "ddi_fw"
9
- version = "0.0.212"
9
+ version = "0.0.214"
10
10
  description = "Do not use :)"
11
11
  readme = "README.md"
12
12
  authors = [
@@ -156,7 +156,7 @@ class MultiModalRunner:
156
156
  (self.y_test_label.shape[0], self.y_test_label.shape[1]))
157
157
  for item in combination:
158
158
  prediction = prediction + single_results[item]
159
- prediction = np.argmax(prediction, axis=1)
159
+ prediction = utils.to_one_hot_encode(prediction)
160
160
  logs, metrics = evaluate(
161
161
  actual=self.y_test_label, pred=prediction, info=combination_descriptor)
162
162
  if self.use_mlflow:
@@ -183,11 +183,11 @@ class TFModelWrapper(ModelWrapper):
183
183
  actual = self.test_label
184
184
  # if not utils.is_binary_encoded(pred):
185
185
  # pred = tf.keras.utils.to_categorical(np.argmax(pred,axis=1), num_classes=self.num_classes)
186
- pred= convert_to_categorical(pred, self.num_classes)
187
- actual= convert_to_categorical(actual, self.num_classes)
186
+ pred_as_cat= convert_to_categorical(pred, self.num_classes)
187
+ actual_as_cat= convert_to_categorical(actual, self.num_classes)
188
188
 
189
189
  logs, metrics = evaluate(
190
- actual=actual, pred=pred, info=self.descriptor, print_detail=print_detail)
190
+ actual=actual_as_cat, pred=pred_as_cat, info=self.descriptor, print_detail=print_detail)
191
191
  metrics.format_float()
192
192
  mlflow.log_metrics(logs)
193
193
  mlflow.log_param('best_cv', best_model_key)
@@ -4,5 +4,5 @@ from .py7zr_helper import Py7ZipHelper
4
4
  from .enums import UMLSCodeTypes, DrugBankTextDataTypes
5
5
  from .package_helper import get_import
6
6
  from .kaggle import create_kaggle_dataset
7
- from .categorical_data_encoding_checker import is_one_hot_encoded, is_binary_encoded, is_binary_vector,is_label_encoded
7
+ from .categorical_data_encoding_checker import to_one_hot_encode,is_one_hot_encoded, is_binary_encoded, is_binary_vector,is_label_encoded
8
8
  from .numpy_utils import adjust_array_dims
@@ -0,0 +1,90 @@
1
+ import numpy as np
2
+
3
+ def to_one_hot_encode(arr):
4
+ """
5
+ Convert a multi-dimensional array (1D, 2D, or 3D) into a one-hot encoded array.
6
+
7
+ Parameters:
8
+ arr (numpy.ndarray): An array where each element or row (or slice) contains class indices or class probabilities.
9
+
10
+ Returns:
11
+ numpy.ndarray: One-hot encoded array.
12
+ """
13
+ # Check if the input is a numpy array
14
+ if not isinstance(arr, np.ndarray):
15
+ raise ValueError("Input must be a numpy array")
16
+
17
+ # Get the shape of the input
18
+ shape = arr.shape
19
+
20
+ # If the array is 1D, treat it as a list of class indices
21
+ if arr.ndim == 1:
22
+ num_classes = np.max(arr) + 1
23
+ one_hot = np.zeros((shape[0], num_classes))
24
+ one_hot[np.arange(shape[0]), arr] = 1
25
+
26
+ # If the array is 2D, treat each row as a list of class indices
27
+ elif arr.ndim == 2:
28
+ num_classes = shape[1]
29
+ one_hot = np.zeros((shape[0], num_classes))
30
+ # Handle one-hot encoding for each row (max index for each row)
31
+ max_indices = np.argmax(arr, axis=1)
32
+ one_hot[np.arange(shape[0]), max_indices] = 1
33
+
34
+ # If the array is 3D or higher, iterate over the first axis and apply one-hot encoding for each slice
35
+ elif arr.ndim >= 3:
36
+ num_classes = shape[-1]
37
+ # Initialize the output array for one-hot encoding with the same shape as input, but the last dimension is num_classes
38
+ one_hot = np.zeros_like(arr, dtype=int)
39
+
40
+ # Iterate through the first axis (the batch dimension)
41
+ for i in range(shape[0]):
42
+ # Get the max indices along the second dimension for each slice
43
+ max_indices = np.argmax(arr[i], axis=1)
44
+ # Set the corresponding one-hot vectors in the slice
45
+ one_hot[i, np.arange(shape[1]), max_indices] = 1
46
+
47
+ return one_hot
48
+
49
+
50
+ def is_one_hot_encoded(arr):
51
+ # Check if the array is one-hot encoded
52
+ # Ensure the input is a numpy ndarray and is 2D
53
+ if not isinstance(arr, np.ndarray):
54
+ raise ValueError("Input must be a NumPy ndarray.")
55
+ if not np.all(np.isin(arr, [0, 1])):
56
+ return False
57
+ # Check if each row (or column) has exactly one "1"
58
+ return np.all(np.sum(arr, axis=1) == 1) # For row-wise checking
59
+
60
+
61
+ def is_binary_encoded(arr):
62
+ # Ensure the input is a numpy ndarray and is 2D
63
+ if not isinstance(arr, np.ndarray):
64
+ raise ValueError("Input must be a NumPy ndarray.")
65
+ if arr.ndim != 2:
66
+ raise ValueError("Input must be a 2D array.")
67
+
68
+ # Check if all elements are either 0 or 1
69
+ return np.all(np.isin(arr, [0, 1]))
70
+
71
+
72
+ def is_binary_vector(arr):
73
+ # Ensure the input is a numpy ndarray and is 1D
74
+ if not isinstance(arr, np.ndarray):
75
+ raise ValueError("Input must be a NumPy ndarray.")
76
+ if arr.ndim != 1:
77
+ raise ValueError("Input must be a 1D array.")
78
+ return arr.ndim == 1 and np.all(np.isin(arr, [0, 1]))
79
+
80
+
81
+ def is_label_encoded(arr):
82
+ # Check if the array is label encoded
83
+ # Ensure the input is a numpy ndarray and is 1D
84
+ if not isinstance(arr, np.ndarray):
85
+ raise ValueError("Input must be a NumPy ndarray.")
86
+ if arr.ndim != 1:
87
+ raise ValueError("Input must be a 1D array.")
88
+
89
+ # Check if all values are non-negative integers (possible class labels)
90
+ return np.issubdtype(arr.dtype, np.integer) and np.all(arr >= 0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ddi_fw
3
- Version: 0.0.212
3
+ Version: 0.0.214
4
4
  Summary: Do not use :)
5
5
  Author-email: Kıvanç Bayraktar <bayraktarkivanc@gmail.com>
6
6
  Maintainer-email: Kıvanç Bayraktar <bayraktarkivanc@gmail.com>
@@ -1,44 +0,0 @@
1
- import numpy as np
2
-
3
-
4
- def is_one_hot_encoded(arr):
5
- # Check if the array is one-hot encoded
6
- # Ensure the input is a numpy ndarray and is 2D
7
- if not isinstance(arr, np.ndarray):
8
- raise ValueError("Input must be a NumPy ndarray.")
9
- if not np.all(np.isin(arr, [0, 1])):
10
- return False
11
- # Check if each row (or column) has exactly one "1"
12
- return np.all(np.sum(arr, axis=1) == 1) # For row-wise checking
13
-
14
-
15
- def is_binary_encoded(arr):
16
- # Ensure the input is a numpy ndarray and is 2D
17
- if not isinstance(arr, np.ndarray):
18
- raise ValueError("Input must be a NumPy ndarray.")
19
- if arr.ndim != 2:
20
- raise ValueError("Input must be a 2D array.")
21
-
22
- # Check if all elements are either 0 or 1
23
- return np.all(np.isin(arr, [0, 1]))
24
-
25
-
26
- def is_binary_vector(arr):
27
- # Ensure the input is a numpy ndarray and is 1D
28
- if not isinstance(arr, np.ndarray):
29
- raise ValueError("Input must be a NumPy ndarray.")
30
- if arr.ndim != 1:
31
- raise ValueError("Input must be a 1D array.")
32
- return arr.ndim == 1 and np.all(np.isin(arr, [0, 1]))
33
-
34
-
35
- def is_label_encoded(arr):
36
- # Check if the array is label encoded
37
- # Ensure the input is a numpy ndarray and is 1D
38
- if not isinstance(arr, np.ndarray):
39
- raise ValueError("Input must be a NumPy ndarray.")
40
- if arr.ndim != 1:
41
- raise ValueError("Input must be a 1D array.")
42
-
43
- # Check if all values are non-negative integers (possible class labels)
44
- return np.issubdtype(arr.dtype, np.integer) and np.all(arr >= 0)
File without changes
File without changes
File without changes