Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -65,19 +65,19 @@ def load_data():
|
|
65 |
'Fungal infection': 0, 'Allergy': 1, 'GERD': 2, 'Chronic cholestasis': 3, 'Drug Reaction': 4,
|
66 |
'Peptic ulcer disease': 5, 'AIDS': 6, 'Diabetes ': 7, 'Gastroenteritis': 8, 'Bronchial Asthma': 9,
|
67 |
'Hypertension ': 10, 'Migraine': 11, 'Cervical spondylosis': 12, 'Paralysis (brain hemorrhage)': 13,
|
68 |
-
'Jaundice': 14, 'Malaria': 15, 'Chicken pox': 16, 'Dengue': 17, 'Typhoid': 18,
|
69 |
-
'Hepatitis B': 20, 'Hepatitis C': 21, 'Hepatitis D': 22, 'Hepatitis E': 23,
|
70 |
-
'Tuberculosis': 25, 'Common Cold': 26, 'Pneumonia': 27,
|
71 |
-
'Heart attack':
|
72 |
-
'Hypoglycemia':
|
73 |
-
'(vertigo) Paroxysmal Positional Vertigo':
|
74 |
-
'Psoriasis':
|
75 |
}
|
76 |
|
77 |
# Replace prognosis values with numerical categories
|
78 |
df.replace({'prognosis': disease_dict}, inplace=True)
|
79 |
|
80 |
-
# Print unique values for debugging
|
81 |
print("Unique values in prognosis after mapping:", df['prognosis'].unique())
|
82 |
|
83 |
# Ensure prognosis is purely numerical after mapping
|
@@ -91,7 +91,7 @@ def load_data():
|
|
91 |
# Similar process for the testing data
|
92 |
tr.replace({'prognosis': disease_dict}, inplace=True)
|
93 |
|
94 |
-
#
|
95 |
print("Unique values in prognosis for testing data after mapping:", tr['prognosis'].unique())
|
96 |
|
97 |
if tr['prognosis'].dtype == 'object': # Check for unmapped entries
|
@@ -111,7 +111,7 @@ y_test = tr['prognosis']
|
|
111 |
|
112 |
# Encode the target variable with LabelEncoder if still in string format
|
113 |
le = LabelEncoder()
|
114 |
-
y_encoded = le.fit_transform(y) #
|
115 |
|
116 |
def train_models():
|
117 |
models = {
|
|
|
65 |
'Fungal infection': 0, 'Allergy': 1, 'GERD': 2, 'Chronic cholestasis': 3, 'Drug Reaction': 4,
|
66 |
'Peptic ulcer disease': 5, 'AIDS': 6, 'Diabetes ': 7, 'Gastroenteritis': 8, 'Bronchial Asthma': 9,
|
67 |
'Hypertension ': 10, 'Migraine': 11, 'Cervical spondylosis': 12, 'Paralysis (brain hemorrhage)': 13,
|
68 |
+
'Jaundice': 14, 'Malaria': 15, 'Chicken pox': 16, 'Dengue': 17, 'Typhoid': 18,
|
69 |
+
'Hepatitis A': 19, 'Hepatitis B': 20, 'Hepatitis C': 21, 'Hepatitis D': 22, 'Hepatitis E': 23,
|
70 |
+
'Alcoholic hepatitis': 24, 'Tuberculosis': 25, 'Common Cold': 26, 'Pneumonia': 27,
|
71 |
+
'Heart attack': 28, 'Varicose veins': 29, 'Hypothyroidism': 30, 'Hyperthyroidism': 31,
|
72 |
+
'Hypoglycemia': 32, 'Osteoarthritis': 33, 'Arthritis': 34,
|
73 |
+
'(vertigo) Paroxysmal Positional Vertigo': 35, 'Acne': 36, 'Urinary tract infection': 37,
|
74 |
+
'Psoriasis': 38, 'Impetigo': 39
|
75 |
}
|
76 |
|
77 |
# Replace prognosis values with numerical categories
|
78 |
df.replace({'prognosis': disease_dict}, inplace=True)
|
79 |
|
80 |
+
# Print unique values in prognosis for debugging
|
81 |
print("Unique values in prognosis after mapping:", df['prognosis'].unique())
|
82 |
|
83 |
# Ensure prognosis is purely numerical after mapping
|
|
|
91 |
# Similar process for the testing data
|
92 |
tr.replace({'prognosis': disease_dict}, inplace=True)
|
93 |
|
94 |
+
# Check unique values in testing data
|
95 |
print("Unique values in prognosis for testing data after mapping:", tr['prognosis'].unique())
|
96 |
|
97 |
if tr['prognosis'].dtype == 'object': # Check for unmapped entries
|
|
|
111 |
|
112 |
# Encode the target variable with LabelEncoder if still in string format
|
113 |
le = LabelEncoder()
|
114 |
+
y_encoded = le.fit_transform(y) # We assume all labels are present and valid here
|
115 |
|
116 |
def train_models():
|
117 |
models = {
|