cosine-sim-engine 0.1.0__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Luis Mendez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,26 @@
1
+ # Third-Party Notices
2
+
3
+ ## DDXPlus Dataset
4
+
5
+ This project contains derived data generated from the DDXPlus dataset.
6
+
7
+ The original DDXPlus dataset is licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0) license.
8
+
9
+ Original dataset:
10
+ https://github.com/mila-iqia/ddxplus#ddxplus-a-new-dataset-for-automatic-medical-diagnosis
11
+
12
+ License:
13
+ https://creativecommons.org/licenses/by/4.0/
14
+
15
+ Original publication:
16
+
17
+ Tchango, A. F., Goel, R., Wen, Z., Martel, J., & Ghosn, J. (2022).
18
+ **DDXPlus: A New Dataset for Automatic Medical Diagnosis.**
19
+ NeurIPS 2022 Datasets and Benchmarks Track.
20
+ https://doi.org/10.48550/arXiv.2205.09148
21
+
22
+ ### Modifications
23
+
24
+ The CSV files distributed with this library are derived from the original DDXPlus dataset. They were generated by processing the original data into disease prototype vectors for cosine similarity–based disease classification.
25
+
26
+ The derived data is not part of the original DDXPlus distribution and does not contain the original patient records.
@@ -0,0 +1,121 @@
1
+ Metadata-Version: 2.4
2
+ Name: cosine_sim_engine
3
+ Version: 0.1.0
4
+ Summary: Cosine similarity engine for disease classification.
5
+ Author: Luis Mendez
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/Mendez016/Disease-Diagnosis-Engine-V1/tree/main
8
+ Requires-Python: >=3.10
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ License-File: NOTICE.md
12
+ Requires-Dist: numpy>=2.0
13
+ Requires-Dist: pandas>=2.0
14
+ Requires-Dist: pytest
15
+ Dynamic: license-file
16
+
17
+ # Disease Diagnosis Retrieval Engine
18
+
19
+ Disease Diagnosis Retrieval Engine is a personal machine learning project born from the idea of applying concepts learned throughout my computer science education to a real-world healthcare problem. As machine learning continues to mature, it has the potential to support professionals by automating repetitive analytical tasks and providing decision-support tools, allowing experts to dedicate more time to complex cases that require human judgment.
20
+
21
+ With this motivation, I developed the Disease Diagnosis Retrieval Engine as a platform to explore the complete lifecycle of a machine learning system—from large-scale data preprocessing and feature engineering to vector-space representation, prototype learning, similarity-based retrieval, and model evaluation. The project also investigates how a nearest-centroid classifier behaves under incomplete or sparse patient information, reflecting the challenges encountered in practical diagnostic settings.
22
+
23
+ While the current implementation is intended for research and experimentation, it establishes a modular foundation that can be extended with natural language interfaces, explainable and statistics supported recommendations, and interactive symptom acquisition in future iterations.
24
+
25
+ ## Architecture
26
+
27
+ <img width="1364" height="1112" alt="Disease_Engine_v1_diagram drawio (3)" src="https://github.com/user-attachments/assets/c8df17cd-1ab2-4206-b9f5-f9306188b2b1" />
28
+
29
+ ## Mathematical foundation
30
+ The mathematical foundation of the retrieval and recommendation system is completely based on Linear Algebra concepts and vector operations and conclusions that will be explained in the following sections.
31
+
32
+ ### How does this system generate a diagnosis?
33
+ The core of this system is the formula of the dot-product of two vectors and how it can be used to find the angle between two vectors:
34
+
35
+ $$
36
+ \large{|u \cdot v| = |u||v|cos(\theta)}
37
+ $$
38
+
39
+ $$
40
+ \large{\frac{|u \cdot v|}{|u||v|} = cos(\theta)}
41
+ $$
42
+
43
+ The system displays the top-5 diagnosis vector profiles that are the closest to the provided patient vector. To do so, it calculates the cosine of the angle between the vector provided by the patient and the vectors of all the possible diagnosis, then retrieves the top-5 diagnosis profile vectors that yield the highest cosine results, that is, the diagnosis profile vectors that are the most similar to the patient vector. Ensuring that the returned results are those who are mathematically similar to the provided patient information.
44
+
45
+ ### How are diagnosis profile vectors computed?
46
+ #### Feature generation
47
+ Features are generated by parsing the documentation of the DDXPlus dataset that contains all the possible evidences that the dataset contains, extracting and standardizing all the documented evidences into an empty dataframe where the column names are all the possible evidences.
48
+
49
+ #### Feature extraction
50
+ Features are extracted from each record present in the DDXPlus dataset by cleaning and standardizing all the values contained in the evidences array contained by each record, then, an empty row is created in the documented evidences dataset and then the columns corresponding to the evidences from the original record are set to 1. Finally, any NaN values are replaced by zero to create the binary encoding, or replaced by negative one to create the signed encoding.
51
+
52
+ #### Profile vector computation
53
+ Once all records have been processed and its features extracted, each record is represented by containing the true diagnosis and a value in each evidence column representing the presence of the symptom in the record or its absence. To generate the centroids, those rows are grouped by the true diagnosis column and the average of each column is taken.
54
+
55
+ $$Profile_{diagnosis} = \frac{\sum i}{n} $$
56
+
57
+ Where the profile for a specific diagnosis is calculated by taking the average of all the vectors whose true diagnosis matches the provided diagnosis.
58
+
59
+ As an observation, once this process is finished with binary encoding, each cell in the dataframe represents the empirical probability that a person has a each symptom given their diagnosis.
60
+
61
+ ### Validation
62
+ So far, this model has only been validated under the Cosine Similarity retrieval methodology, other methods such as weighted Cosine Similarity and Euclidean Distance can be tested in future iterations.
63
+
64
+ This model was evaluated in two different configurations: Binary encoding for both training data an validation data simulating the case where a user expresses the presence and absence of all the evidences in the dataset, And a signed encoding for training data while keeping binary encoding for validation data for simulating more realistic scenarios where a user only states the presence of a series of symptoms while not stating the explicit absence/presence of the rest of the symptoms. The results are the following:
65
+
66
+ #### Binary encoded training validation:
67
+
68
+ F1-score: 0.99
69
+
70
+ Weighted precision average: 0.99
71
+
72
+ Lowest precision achieved: 0.86
73
+
74
+ Highest precision achieved: 1.00
75
+
76
+ Weighted recall average: 0.99
77
+
78
+ Lowest recall achieved: 0.78
79
+
80
+ Highest recall achieved: 1.00
81
+
82
+ #### Signed encoded training validation:
83
+
84
+ F1-score: 0.97
85
+
86
+ Weighted precision average: 0.98
87
+
88
+ Lowest precision achieved: 0.50
89
+
90
+ Highest precision achieved: 1.00
91
+
92
+ Weighted recall average: 0.97
93
+
94
+ Lowest recall achieved: 0.32
95
+
96
+ Highest recall achieved: 1.00
97
+
98
+ Note: The lowest precisions and lowest recalls in both validation cases happen mostly between pairs of diagnosis that are clinicaly close to each other (example: Chronic Rhinosinousitis and Acute Rhinosinousitis). In the case of the signed encoded training, it is expected to have a lower performance as it is deliberately given less information for accurately generating a diagnosis.
99
+
100
+ ## Data Attribution
101
+
102
+ This library includes a derived model generated from the DDXPlus dataset.
103
+
104
+ DDXPlus is licensed under the Creative Commons Attribution 4.0 International
105
+ (CC BY 4.0) license.
106
+
107
+ Original dataset:
108
+ https://github.com/mila-iqia/ddxplus#ddxplus-a-new-dataset-for-automatic-medical-diagnosis
109
+
110
+ License:
111
+ https://creativecommons.org/licenses/by/4.0/
112
+
113
+ Original paper:
114
+
115
+ > Tchango, A. F., Goel, R., Wen, Z., Martel, J., & Ghosn, J. (2022).
116
+ > **DDXPlus: A New Dataset for Automatic Medical Diagnosis.**
117
+ > NeurIPS 2022 Datasets and Benchmarks Track.
118
+ > DOI: https://doi.org/10.48550/arXiv.2205.09148
119
+
120
+ The dataset was transformed to produce the disease prototype vectors included
121
+ with this package.
@@ -0,0 +1,105 @@
1
+ # Disease Diagnosis Retrieval Engine
2
+
3
+ Disease Diagnosis Retrieval Engine is a personal machine learning project born from the idea of applying concepts learned throughout my computer science education to a real-world healthcare problem. As machine learning continues to mature, it has the potential to support professionals by automating repetitive analytical tasks and providing decision-support tools, allowing experts to dedicate more time to complex cases that require human judgment.
4
+
5
+ With this motivation, I developed the Disease Diagnosis Retrieval Engine as a platform to explore the complete lifecycle of a machine learning system—from large-scale data preprocessing and feature engineering to vector-space representation, prototype learning, similarity-based retrieval, and model evaluation. The project also investigates how a nearest-centroid classifier behaves under incomplete or sparse patient information, reflecting the challenges encountered in practical diagnostic settings.
6
+
7
+ While the current implementation is intended for research and experimentation, it establishes a modular foundation that can be extended with natural language interfaces, explainable and statistics supported recommendations, and interactive symptom acquisition in future iterations.
8
+
9
+ ## Architecture
10
+
11
+ <img width="1364" height="1112" alt="Disease_Engine_v1_diagram drawio (3)" src="https://github.com/user-attachments/assets/c8df17cd-1ab2-4206-b9f5-f9306188b2b1" />
12
+
13
+ ## Mathematical foundation
14
+ The mathematical foundation of the retrieval and recommendation system is completely based on Linear Algebra concepts and vector operations and conclusions that will be explained in the following sections.
15
+
16
+ ### How does this system generate a diagnosis?
17
+ The core of this system is the formula of the dot-product of two vectors and how it can be used to find the angle between two vectors:
18
+
19
+ $$
20
+ \large{|u \cdot v| = |u||v|cos(\theta)}
21
+ $$
22
+
23
+ $$
24
+ \large{\frac{|u \cdot v|}{|u||v|} = cos(\theta)}
25
+ $$
26
+
27
+ The system displays the top-5 diagnosis vector profiles that are the closest to the provided patient vector. To do so, it calculates the cosine of the angle between the vector provided by the patient and the vectors of all the possible diagnosis, then retrieves the top-5 diagnosis profile vectors that yield the highest cosine results, that is, the diagnosis profile vectors that are the most similar to the patient vector. Ensuring that the returned results are those who are mathematically similar to the provided patient information.
28
+
29
+ ### How are diagnosis profile vectors computed?
30
+ #### Feature generation
31
+ Features are generated by parsing the documentation of the DDXPlus dataset that contains all the possible evidences that the dataset contains, extracting and standardizing all the documented evidences into an empty dataframe where the column names are all the possible evidences.
32
+
33
+ #### Feature extraction
34
+ Features are extracted from each record present in the DDXPlus dataset by cleaning and standardizing all the values contained in the evidences array contained by each record, then, an empty row is created in the documented evidences dataset and then the columns corresponding to the evidences from the original record are set to 1. Finally, any NaN values are replaced by zero to create the binary encoding, or replaced by negative one to create the signed encoding.
35
+
36
+ #### Profile vector computation
37
+ Once all records have been processed and its features extracted, each record is represented by containing the true diagnosis and a value in each evidence column representing the presence of the symptom in the record or its absence. To generate the centroids, those rows are grouped by the true diagnosis column and the average of each column is taken.
38
+
39
+ $$Profile_{diagnosis} = \frac{\sum i}{n} $$
40
+
41
+ Where the profile for a specific diagnosis is calculated by taking the average of all the vectors whose true diagnosis matches the provided diagnosis.
42
+
43
+ As an observation, once this process is finished with binary encoding, each cell in the dataframe represents the empirical probability that a person has a each symptom given their diagnosis.
44
+
45
+ ### Validation
46
+ So far, this model has only been validated under the Cosine Similarity retrieval methodology, other methods such as weighted Cosine Similarity and Euclidean Distance can be tested in future iterations.
47
+
48
+ This model was evaluated in two different configurations: Binary encoding for both training data an validation data simulating the case where a user expresses the presence and absence of all the evidences in the dataset, And a signed encoding for training data while keeping binary encoding for validation data for simulating more realistic scenarios where a user only states the presence of a series of symptoms while not stating the explicit absence/presence of the rest of the symptoms. The results are the following:
49
+
50
+ #### Binary encoded training validation:
51
+
52
+ F1-score: 0.99
53
+
54
+ Weighted precision average: 0.99
55
+
56
+ Lowest precision achieved: 0.86
57
+
58
+ Highest precision achieved: 1.00
59
+
60
+ Weighted recall average: 0.99
61
+
62
+ Lowest recall achieved: 0.78
63
+
64
+ Highest recall achieved: 1.00
65
+
66
+ #### Signed encoded training validation:
67
+
68
+ F1-score: 0.97
69
+
70
+ Weighted precision average: 0.98
71
+
72
+ Lowest precision achieved: 0.50
73
+
74
+ Highest precision achieved: 1.00
75
+
76
+ Weighted recall average: 0.97
77
+
78
+ Lowest recall achieved: 0.32
79
+
80
+ Highest recall achieved: 1.00
81
+
82
+ Note: The lowest precisions and lowest recalls in both validation cases happen mostly between pairs of diagnosis that are clinicaly close to each other (example: Chronic Rhinosinousitis and Acute Rhinosinousitis). In the case of the signed encoded training, it is expected to have a lower performance as it is deliberately given less information for accurately generating a diagnosis.
83
+
84
+ ## Data Attribution
85
+
86
+ This library includes a derived model generated from the DDXPlus dataset.
87
+
88
+ DDXPlus is licensed under the Creative Commons Attribution 4.0 International
89
+ (CC BY 4.0) license.
90
+
91
+ Original dataset:
92
+ https://github.com/mila-iqia/ddxplus#ddxplus-a-new-dataset-for-automatic-medical-diagnosis
93
+
94
+ License:
95
+ https://creativecommons.org/licenses/by/4.0/
96
+
97
+ Original paper:
98
+
99
+ > Tchango, A. F., Goel, R., Wen, Z., Martel, J., & Ghosn, J. (2022).
100
+ > **DDXPlus: A New Dataset for Automatic Medical Diagnosis.**
101
+ > NeurIPS 2022 Datasets and Benchmarks Track.
102
+ > DOI: https://doi.org/10.48550/arXiv.2205.09148
103
+
104
+ The dataset was transformed to produce the disease prototype vectors included
105
+ with this package.
@@ -0,0 +1,33 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "cosine_sim_engine"
7
+ version = "0.1.0"
8
+ description = "Cosine similarity engine for disease classification."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+
13
+ authors = [
14
+ { name = "Luis Mendez" }
15
+ ]
16
+
17
+ dependencies = [
18
+ "numpy>=2.0",
19
+ "pandas>=2.0",
20
+ "pytest"
21
+ ]
22
+
23
+ [tool.setuptools]
24
+ package-dir = { "" = "src" }
25
+
26
+ [tool.setuptools.packages.find]
27
+ where = ["src"]
28
+
29
+ [tool.setuptools.package-data]
30
+ cosine_sim_engine = ["data/*.csv"]
31
+
32
+ [project.urls]
33
+ Homepage = "https://github.com/Mendez016/Disease-Diagnosis-Engine-V1/tree/main"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,5 @@
1
+ from .classify import Cosine_sim_classifier
2
+
3
+ __version__ = "0.1.0"
4
+
5
+ __all__ = ["Cosine_sim_classifier"]
@@ -0,0 +1,124 @@
1
+ import pandas as pd
2
+ import numpy as np
3
+ from importlib.resources import files
4
+ from .custom_errors import *
5
+
6
+ class Cosine_sim_classifier:
7
+ def __init__(self, model = None, labels = None):
8
+ if model is None and labels is None:
9
+ self.model = pd.read_csv(files("cosine_sim_engine.data") / "prototype_vectors.csv" )
10
+ self.labels = self.model.columns.tolist()[0]
11
+ self.features = pd.read_csv(files("cosine_sim_engine.data") / "features.csv").drop(columns=["Diagnosis", "Age"])
12
+
13
+ elif model is not None and labels is not None:
14
+ if not isinstance(model, pd.DataFrame):
15
+ raise TypeError("The model must be a pandas DataFrame.")
16
+
17
+ if not isinstance(labels, str):
18
+ raise TypeError("The labels must be a string representing the column name of the labels in the model DataFrame.")
19
+
20
+ if labels not in model.columns or labels is None:
21
+ raise InvalidLabelColumnError(self.labels)
22
+
23
+ self.model = model
24
+ self.labels = labels
25
+ self.features = pd.DataFrame(columns = model.drop(columns=[labels]).columns.to_list())
26
+ else:
27
+ raise ValueError("The model, labels, and features must be provided together or not at all. Please provide all three parameters or none.")
28
+
29
+ def similarity(self, vector, k=5):
30
+
31
+ if k < 1 or k > self.model.shape[0]:
32
+ raise InvalidTop_KError(k)
33
+
34
+ if not isinstance(vector, np.ndarray) and not isinstance(vector, list) and not isinstance(vector, pd.Series):
35
+ raise InvalidVectorTypeError(resulting_type=type(vector))
36
+
37
+ if len(vector) != self.model.shape[1] - 1:
38
+ raise InvalidVectorSizeError(self.model.shape[1] - 1, len(vector))
39
+
40
+ vector_len = np.sqrt(vector**2).sum()
41
+ possible_diagnosis = self.model[[self.labels]].copy()
42
+ diagnosis_profiles = self.model.drop(columns = [self.labels])
43
+ scores = []
44
+
45
+ for i in range(self.model.shape[0]):
46
+ row = diagnosis_profiles.iloc[i]
47
+ row_len = np.sqrt(row**2).sum()
48
+ dot_product = (row * vector).sum()
49
+ cosine_score = dot_product / (vector_len * row_len)
50
+ scores.append(cosine_score)
51
+
52
+ possible_diagnosis["Scores"] = scores
53
+ top_k = possible_diagnosis.sort_values(by="Scores", ascending=False).head(k)
54
+ return top_k
55
+
56
+ def get_model(self):
57
+ return self.model
58
+
59
+ def get_features(self):
60
+ return self.features
61
+
62
+ def get_labels(self):
63
+ return self.labels
64
+
65
+ def extract_features(self, data):
66
+ if isinstance(data, dict):
67
+ return self.extract_dict(data)
68
+ elif isinstance(data, list):
69
+ return self.extract_list(data)
70
+ elif isinstance(data, pd.DataFrame):
71
+ return self.extract_df(data)
72
+ else:
73
+ raise TypeError("The record must be a dictionary, list, or pandas DataFrame.")
74
+
75
+ def extract_dict(self, record: dict):
76
+ if len(record) > self.features.shape[1]:
77
+ raise ValueError("The record contains more features than the model supports. Please provide a record with the correct number of features.")
78
+
79
+ new_record = self.features.copy()
80
+ new_record = new_record.T
81
+ new_record[0] = np.zeros(new_record.shape[0], dtype=int)
82
+ new_record = new_record.T
83
+
84
+ given_features = list(record.keys())
85
+
86
+ for i in given_features:
87
+ if i not in self.features.columns:
88
+ raise ValueError(f"The symptom '{i}' is not a valid feature. Please provide a record with valid symptom names.")
89
+ new_record[i] = record[i]
90
+ ## Extracts features to be used from a given record structured as a dictionary holding keys and values for each symptom
91
+ ## Expected structure of the dictionary is {symptom_name: symptom_value, ...}. Any not present symptom will be treated as 0 (no information gathered)
92
+
93
+ return new_record.iloc[0]
94
+
95
+ def extract_list(self, record: list):
96
+ if len(record) > self.features.shape[1]:
97
+ raise ValueError("The record contains more features than the model supports. Please provide a record with the correct number of features.")
98
+
99
+ new_record = self.features.copy()
100
+ new_record = new_record.T
101
+ new_record[0] = np.ones(new_record.shape[0], dtype=int) * -1
102
+ new_record = new_record.T
103
+
104
+ for i in record:
105
+ if i not in self.features.columns:
106
+ raise ValueError(f"The symptom code '{i}' is not a valid feature. Please provide a record with valid symptom codes.")
107
+ new_record[i] = 1
108
+ ## Extracts features to be used from a given record structured as a list of values for each symptom
109
+ ## Expected structure of the list is [symptom_code_1, symptom_code_2, ...]. Any not present symptom will be treated as -1 (explicitly not present)
110
+ return new_record.iloc[0]
111
+
112
+ def extract_df(self, record: pd.DataFrame):
113
+ if record.shape[1] > self.features.shape[1]:
114
+ raise ValueError("The record contains more features than the model supports. Please provide a record with the correct number of features.")
115
+
116
+ new_record = self.features.copy()
117
+
118
+ new_record = pd.concat([new_record, record], ignore_index = True)
119
+ if new_record.shape[1] != self.features.shape[1]:
120
+ raise ValueError("The record contains more features than the model supports or the record contains invalid features. Please provide a record with the correct number of features.")
121
+ ## Extracts features to be used from a given record structured as a pandas DataFrame holding columns and rows for each symptom
122
+ ## Expected structure of the DataFrame is columns as symptom names and rows as symptom values. Any not present symptom will be treated as 0 (no information gathered)
123
+
124
+ return new_record.iloc[0]
@@ -0,0 +1,39 @@
1
+ class InvalidTop_KError(Exception):
2
+ def __init__(self, value, message="Invalid top-K value"):
3
+ super().__init__(message)
4
+ self.value = value
5
+
6
+ def __str__(self):
7
+ if self.value < 1:
8
+ return f"InvalidTop_KError: {self.value} is not a valid top-K value. K must be a positive integer greater than 0."
9
+ else:
10
+ return f"InvalidTop_KError: {self.value} is not a valid top-K value. K must be less than or equal to the number of available labels."
11
+
12
+ class InvalidLabelColumnError(Exception):
13
+ def __init__(self, label, message="Invalid label column"):
14
+ super().__init__(message)
15
+ self.label = label
16
+
17
+ def __str__(self):
18
+ if self.label is None:
19
+ return "InvalidLabelColumnError: The label column must be specified as a valid string and cannot be None."
20
+ else:
21
+ return f"InvalidLabelColumnError: The label column '{self.label}' is not present in the model DataFrame."
22
+
23
+ class InvalidVectorSizeError(Exception):
24
+ def __init__(self, model_columns, vector_size, message="Invalid input vector"):
25
+ super().__init__(message)
26
+ self.model_columns = model_columns
27
+ self.vector_size = vector_size
28
+
29
+ def __str__(self):
30
+ return f"InvalidVectorSizeError: The input vector must have size {self.model_columns} to match the model's feature columns, but got size {self.vector_size}."
31
+
32
+ class InvalidVectorTypeError(Exception):
33
+ def __init__(self, resulting_type, message="Invalid input vector type"):
34
+ super().__init__(message)
35
+ self.type = resulting_type
36
+
37
+ def __str__(self):
38
+ return f"InvalidVectorTypeError: The vector's type is {self.type}. The input vector must be a numpy array, list, pandas Series, or a single-column pandas DataFrame."
39
+
@@ -0,0 +1 @@
1
+ Diagnosis,Age,E_91,E_55_V_123,E_55_V_14,E_55_V_15,E_55_V_16,E_55_V_17,E_55_V_18,E_55_V_19,E_55_V_20,E_55_V_21,E_55_V_22,E_55_V_23,E_55_V_24,E_55_V_25,E_55_V_26,E_55_V_27,E_55_V_28,E_55_V_29,E_55_V_30,E_55_V_31,E_55_V_32,E_55_V_33,E_55_V_34,E_55_V_35,E_55_V_36,E_55_V_37,E_55_V_38,E_55_V_39,E_55_V_40,E_55_V_41,E_55_V_42,E_55_V_43,E_55_V_44,E_55_V_45,E_55_V_46,E_55_V_47,E_55_V_48,E_55_V_49,E_55_V_50,E_55_V_51,E_55_V_52,E_55_V_53,E_55_V_54,E_55_V_55,E_55_V_56,E_55_V_57,E_55_V_58,E_55_V_59,E_55_V_60,E_55_V_61,E_55_V_62,E_55_V_63,E_55_V_64,E_55_V_65,E_55_V_66,E_55_V_67,E_55_V_68,E_55_V_69,E_55_V_70,E_55_V_72,E_55_V_73,E_55_V_74,E_55_V_75,E_55_V_76,E_55_V_77,E_55_V_78,E_55_V_79,E_55_V_80,E_55_V_81,E_55_V_82,E_55_V_83,E_55_V_84,E_55_V_85,E_55_V_87,E_55_V_88,E_55_V_89,E_55_V_90,E_55_V_91,E_55_V_92,E_55_V_93,E_55_V_94,E_55_V_95,E_55_V_96,E_55_V_97,E_55_V_98,E_55_V_99,E_55_V_100,E_55_V_101,E_55_V_102,E_55_V_103,E_55_V_104,E_55_V_105,E_55_V_106,E_55_V_108,E_55_V_109,E_55_V_110,E_55_V_111,E_55_V_113,E_55_V_114,E_55_V_115,E_55_V_116,E_55_V_117,E_55_V_118,E_55_V_119,E_55_V_120,E_55_V_121,E_55_V_122,E_55_V_124,E_55_V_125,E_55_V_126,E_55_V_127,E_55_V_128,E_55_V_129,E_55_V_130,E_55_V_131,E_55_V_132,E_55_V_133,E_55_V_134,E_55_V_135,E_55_V_136,E_55_V_137,E_55_V_139,E_55_V_140,E_55_V_141,E_55_V_142,E_55_V_143,E_55_V_144,E_55_V_145,E_55_V_146,E_55_V_147,E_55_V_148,E_55_V_149,E_55_V_150,E_55_V_151,E_55_V_152,E_55_V_153,E_55_V_155,E_55_V_158,E_55_V_159,E_55_V_160,E_55_V_162,E_55_V_163,E_55_V_164,E_55_V_165,E_55_V_166,E_55_V_167,E_55_V_168,E_55_V_169,E_55_V_170,E_55_V_171,E_55_V_172,E_55_V_173,E_55_V_174,E_55_V_175,E_55_V_176,E_55_V_177,E_55_V_178,E_55_V_185,E_55_V_186,E_55_V_187,E_55_V_188,E_55_V_189,E_55_V_190,E_55_V_194,E_55_V_195,E_55_V_197,E_53,E_57_V_123,E_57_V_14,E_57_V_15,E_57_V_16,E_57_V_17,E_57_V_18,E_57_V_19,E_57_V_20,E_57_V_21,E_57_V_22,E_57_V_23,E_57_V_24,E_57_V_25,E_57_V_26,E_57_V_27,E_57_V_28,E_57_V_29,E_57_V_30,E_57_V_31,E_57_V_32,E_57_V_33,E_57_V_34,E_57_V_35,E_57_V_36,E_57_V_37,E_57_V_38,E_57_V_39,E_57_V_40,E_57_V_41,E_57_V_42,E_57_V_43,E_57_V_44,E_57_V_45,E_57_V_46,E_57_V_47,E_57_V_48,E_57_V_49,E_57_V_50,E_57_V_51,E_57_V_52,E_57_V_53,E_57_V_54,E_57_V_55,E_57_V_56,E_57_V_57,E_57_V_58,E_57_V_59,E_57_V_60,E_57_V_61,E_57_V_62,E_57_V_63,E_57_V_64,E_57_V_65,E_57_V_66,E_57_V_67,E_57_V_68,E_57_V_69,E_57_V_70,E_57_V_72,E_57_V_73,E_57_V_74,E_57_V_75,E_57_V_76,E_57_V_77,E_57_V_78,E_57_V_79,E_57_V_80,E_57_V_81,E_57_V_82,E_57_V_83,E_57_V_84,E_57_V_85,E_57_V_87,E_57_V_88,E_57_V_89,E_57_V_90,E_57_V_91,E_57_V_92,E_57_V_93,E_57_V_94,E_57_V_95,E_57_V_96,E_57_V_97,E_57_V_98,E_57_V_99,E_57_V_100,E_57_V_101,E_57_V_102,E_57_V_103,E_57_V_104,E_57_V_105,E_57_V_106,E_57_V_108,E_57_V_109,E_57_V_110,E_57_V_111,E_57_V_113,E_57_V_114,E_57_V_115,E_57_V_116,E_57_V_117,E_57_V_118,E_57_V_119,E_57_V_120,E_57_V_121,E_57_V_122,E_57_V_124,E_57_V_125,E_57_V_126,E_57_V_127,E_57_V_128,E_57_V_129,E_57_V_130,E_57_V_131,E_57_V_132,E_57_V_133,E_57_V_134,E_57_V_135,E_57_V_136,E_57_V_137,E_57_V_139,E_57_V_140,E_57_V_141,E_57_V_142,E_57_V_143,E_57_V_144,E_57_V_145,E_57_V_146,E_57_V_147,E_57_V_148,E_57_V_149,E_57_V_150,E_57_V_151,E_57_V_152,E_57_V_153,E_57_V_155,E_57_V_158,E_57_V_159,E_57_V_160,E_57_V_162,E_57_V_163,E_57_V_164,E_57_V_165,E_57_V_166,E_57_V_167,E_57_V_168,E_57_V_169,E_57_V_170,E_57_V_171,E_57_V_172,E_57_V_173,E_57_V_174,E_57_V_175,E_57_V_176,E_57_V_177,E_57_V_178,E_57_V_185,E_57_V_186,E_57_V_187,E_57_V_188,E_57_V_189,E_57_V_190,E_57_V_194,E_57_V_195,E_57_V_197,E_54_V_11,E_54_V_71,E_54_V_112,E_54_V_154,E_54_V_161,E_54_V_179,E_54_V_180,E_54_V_181,E_54_V_182,E_54_V_183,E_54_V_184,E_54_V_191,E_54_V_192,E_54_V_193,E_54_V_196,E_54_V_198,E_59_0,E_59_1,E_59_2,E_59_3,E_59_4,E_59_5,E_59_6,E_59_7,E_59_8,E_59_9,E_59_10,E_56_0,E_56_1,E_56_2,E_56_3,E_56_4,E_56_5,E_56_6,E_56_7,E_56_8,E_56_9,E_56_10,E_58_0,E_58_1,E_58_2,E_58_3,E_58_4,E_58_5,E_58_6,E_58_7,E_58_8,E_58_9,E_58_10,E_159,E_133_V_123,E_133_V_14,E_133_V_15,E_133_V_16,E_133_V_17,E_133_V_18,E_133_V_19,E_133_V_20,E_133_V_21,E_133_V_22,E_133_V_23,E_133_V_24,E_133_V_25,E_133_V_26,E_133_V_27,E_133_V_28,E_133_V_29,E_133_V_30,E_133_V_31,E_133_V_32,E_133_V_33,E_133_V_34,E_133_V_35,E_133_V_36,E_133_V_37,E_133_V_38,E_133_V_39,E_133_V_40,E_133_V_41,E_133_V_42,E_133_V_43,E_133_V_44,E_133_V_45,E_133_V_46,E_133_V_47,E_133_V_48,E_133_V_49,E_133_V_50,E_133_V_51,E_133_V_52,E_133_V_53,E_133_V_54,E_133_V_55,E_133_V_56,E_133_V_57,E_133_V_58,E_133_V_59,E_133_V_60,E_133_V_61,E_133_V_62,E_133_V_63,E_133_V_64,E_133_V_65,E_133_V_66,E_133_V_67,E_133_V_68,E_133_V_69,E_133_V_70,E_133_V_72,E_133_V_73,E_133_V_74,E_133_V_75,E_133_V_76,E_133_V_77,E_133_V_78,E_133_V_79,E_133_V_80,E_133_V_81,E_133_V_82,E_133_V_83,E_133_V_84,E_133_V_85,E_133_V_87,E_133_V_88,E_133_V_89,E_133_V_90,E_133_V_91,E_133_V_92,E_133_V_93,E_133_V_94,E_133_V_95,E_133_V_96,E_133_V_97,E_133_V_98,E_133_V_99,E_133_V_100,E_133_V_101,E_133_V_102,E_133_V_103,E_133_V_104,E_133_V_105,E_133_V_106,E_133_V_108,E_133_V_109,E_133_V_110,E_133_V_111,E_133_V_113,E_133_V_114,E_133_V_115,E_133_V_116,E_133_V_117,E_133_V_118,E_133_V_119,E_133_V_120,E_133_V_121,E_133_V_122,E_133_V_124,E_133_V_125,E_133_V_126,E_133_V_127,E_133_V_128,E_133_V_129,E_133_V_130,E_133_V_131,E_133_V_132,E_133_V_133,E_133_V_134,E_133_V_135,E_133_V_136,E_133_V_137,E_133_V_139,E_133_V_140,E_133_V_141,E_133_V_142,E_133_V_143,E_133_V_144,E_133_V_145,E_133_V_146,E_133_V_147,E_133_V_148,E_133_V_149,E_133_V_150,E_133_V_151,E_133_V_152,E_133_V_153,E_133_V_155,E_133_V_158,E_133_V_159,E_133_V_160,E_133_V_162,E_133_V_163,E_133_V_164,E_133_V_165,E_133_V_166,E_133_V_167,E_133_V_168,E_133_V_169,E_133_V_170,E_133_V_171,E_133_V_172,E_133_V_173,E_133_V_174,E_133_V_175,E_133_V_176,E_133_V_177,E_133_V_178,E_133_V_185,E_133_V_186,E_133_V_187,E_133_V_188,E_133_V_189,E_133_V_190,E_133_V_194,E_133_V_195,E_133_V_197,E_129,E_130_V_11,E_130_V_86,E_130_V_107,E_130_V_138,E_130_V_156,E_130_V_157,E_134_0,E_134_1,E_134_2,E_134_3,E_134_4,E_134_5,E_134_6,E_134_7,E_134_8,E_134_9,E_134_10,E_132_0,E_132_1,E_132_2,E_132_3,E_132_4,E_132_5,E_132_6,E_132_7,E_132_8,E_132_9,E_132_10,E_136_0,E_136_1,E_136_2,E_136_3,E_136_4,E_136_5,E_136_6,E_136_7,E_136_8,E_136_9,E_136_10,E_135_V_10,E_135_V_12,E_131_V_10,E_131_V_12,E_154,E_155,E_210,E_140,E_51,E_75,E_89,E_114,E_82,E_148,E_94,E_220,E_161,E_179,E_162,E_173,E_33,E_218,E_93,E_66,E_163,E_30,E_127,E_181,E_88,E_43,E_156,E_144,E_216,E_201,E_217,E_215,E_64,E_96,E_16,E_50,E_97,E_9,E_76,E_102,E_65,E_74,E_205,E_63,E_128,E_190,E_39,E_212,E_206,E_52,E_203,E_38,E_172,E_84,E_90,E_211,E_166,E_112,E_178,E_152_V_123,E_152_V_14,E_152_V_15,E_152_V_16,E_152_V_17,E_152_V_18,E_152_V_19,E_152_V_20,E_152_V_21,E_152_V_22,E_152_V_23,E_152_V_24,E_152_V_25,E_152_V_26,E_152_V_27,E_152_V_28,E_152_V_29,E_152_V_30,E_152_V_31,E_152_V_32,E_152_V_33,E_152_V_34,E_152_V_35,E_152_V_36,E_152_V_37,E_152_V_38,E_152_V_39,E_152_V_40,E_152_V_41,E_152_V_42,E_152_V_43,E_152_V_44,E_152_V_45,E_152_V_46,E_152_V_47,E_152_V_48,E_152_V_49,E_152_V_50,E_152_V_51,E_152_V_52,E_152_V_53,E_152_V_54,E_152_V_55,E_152_V_56,E_152_V_57,E_152_V_58,E_152_V_59,E_152_V_60,E_152_V_61,E_152_V_62,E_152_V_63,E_152_V_64,E_152_V_65,E_152_V_66,E_152_V_67,E_152_V_68,E_152_V_69,E_152_V_70,E_152_V_72,E_152_V_73,E_152_V_74,E_152_V_75,E_152_V_76,E_152_V_77,E_152_V_78,E_152_V_79,E_152_V_80,E_152_V_81,E_152_V_82,E_152_V_83,E_152_V_84,E_152_V_85,E_152_V_87,E_152_V_88,E_152_V_89,E_152_V_90,E_152_V_91,E_152_V_92,E_152_V_93,E_152_V_94,E_152_V_95,E_152_V_96,E_152_V_97,E_152_V_98,E_152_V_99,E_152_V_100,E_152_V_101,E_152_V_102,E_152_V_103,E_152_V_104,E_152_V_105,E_152_V_106,E_152_V_108,E_152_V_109,E_152_V_110,E_152_V_111,E_152_V_113,E_152_V_114,E_152_V_115,E_152_V_116,E_152_V_117,E_152_V_118,E_152_V_119,E_152_V_120,E_152_V_121,E_152_V_122,E_152_V_124,E_152_V_125,E_152_V_126,E_152_V_127,E_152_V_128,E_152_V_129,E_152_V_130,E_152_V_131,E_152_V_132,E_152_V_133,E_152_V_134,E_152_V_135,E_152_V_136,E_152_V_137,E_152_V_139,E_152_V_140,E_152_V_141,E_152_V_142,E_152_V_143,E_152_V_144,E_152_V_145,E_152_V_146,E_152_V_147,E_152_V_148,E_152_V_149,E_152_V_150,E_152_V_151,E_152_V_152,E_152_V_153,E_152_V_155,E_152_V_158,E_152_V_159,E_152_V_160,E_152_V_162,E_152_V_163,E_152_V_164,E_152_V_165,E_152_V_166,E_152_V_167,E_152_V_168,E_152_V_169,E_152_V_170,E_152_V_171,E_152_V_172,E_152_V_173,E_152_V_174,E_152_V_175,E_152_V_176,E_152_V_177,E_152_V_178,E_152_V_185,E_152_V_186,E_152_V_187,E_152_V_188,E_152_V_189,E_152_V_190,E_152_V_194,E_152_V_195,E_152_V_197,E_151,E_45,E_194,E_83,E_157,E_176,E_42,E_214,E_150,E_32,E_221,E_202,E_219,E_196,E_170,E_77,E_13,E_14,E_169,E_177,E_175,E_174,E_145,E_92,E_192,E_188,E_164,E_193,E_168,E_180,E_67,E_78,E_146,E_171,E_111,E_182,E_103,E_23,E_105,E_108,E_104,E_79,E_71,E_41,E_100,E_69,E_167,E_115,E_70,E_10,E_165,E_8,E_25,E_184,E_185,E_99,E_107,E_226,E_62,E_49,E_95,E_204_V_10,E_204_V_0,E_204_V_1,E_204_V_2,E_204_V_3,E_204_V_4,E_204_V_5,E_204_V_6,E_204_V_7,E_204_V_8,E_204_V_9,E_204_V_13,E_37,E_153,E_124,E_98,E_116,E_48,E_2,E_227,E_61,E_47,E_27,E_143,E_191,E_208,E_126,E_189,E_7,E_24,E_26,E_113,E_160,E_28,E_20,E_80,E_40,E_0,E_1,E_34,E_209,E_139,E_19,E_31,E_22,E_60,E_35,E_213,E_12,E_44,E_4,E_81,E_109,E_110,E_17,E_18,E_118,E_123,E_207,E_86,E_87,E_141,E_11,E_186,E_106,E_158,E_187,E_6,E_125,E_21,E_222,E_15,E_147,E_137,E_149,E_197,E_3,E_29,E_225,E_73,E_138,E_101,E_46,E_119,E_72,E_198,E_200,E_199,E_121,E_120,E_142,E_195,E_183,E_224,E_223,E_5