Tejeshsingh commited on
Commit
c657bcf
1 Parent(s): 9dfae14

Upload 2 files

Browse files
Patient_Symptoms_and_Diseases.ipynb ADDED
@@ -0,0 +1,510 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "nbformat": 4,
3
+ "nbformat_minor": 0,
4
+ "metadata": {
5
+ "colab": {
6
+ "provenance": []
7
+ },
8
+ "kernelspec": {
9
+ "name": "python3",
10
+ "display_name": "Python 3"
11
+ },
12
+ "language_info": {
13
+ "name": "python"
14
+ }
15
+ },
16
+ "cells": [
17
+ {
18
+ "cell_type": "markdown",
19
+ "source": [
20
+ "AIMERS"
21
+ ],
22
+ "metadata": {
23
+ "id": "D1-ngpe5C5_X"
24
+ }
25
+ },
26
+ {
27
+ "cell_type": "code",
28
+ "execution_count": null,
29
+ "metadata": {
30
+ "colab": {
31
+ "base_uri": "https://localhost:8080/"
32
+ },
33
+ "id": "FU57l9-06L5O",
34
+ "outputId": "226f6f01-00b7-453c-b066-542f95f278e8"
35
+ },
36
+ "outputs": [
37
+ {
38
+ "output_type": "stream",
39
+ "name": "stderr",
40
+ "text": [
41
+ "/usr/local/lib/python3.8/dist-packages/torch/cuda/__init__.py:497: UserWarning: Can't initialize NVML\n",
42
+ " warnings.warn(\"Can't initialize NVML\")\n"
43
+ ]
44
+ },
45
+ {
46
+ "output_type": "stream",
47
+ "name": "stdout",
48
+ "text": [
49
+ "Accuracy: 0.0\n",
50
+ "Classification Report:\n",
51
+ " precision recall f1-score support\n",
52
+ "\n",
53
+ " Acanthosis nigricans 0.00 0.00 0.00 0.0\n",
54
+ " Acariasis 0.00 0.00 0.00 0.0\n",
55
+ " Acne 0.00 0.00 0.00 0.0\n",
56
+ " Acute bronchitis 0.00 0.00 0.00 1.0\n",
57
+ " Acute bronchospasm 0.00 0.00 0.00 1.0\n",
58
+ " Acute glaucoma 0.00 0.00 0.00 1.0\n",
59
+ " Acute pancreatitis 0.00 0.00 0.00 0.0\n",
60
+ " Acute stress reaction 0.00 0.00 0.00 1.0\n",
61
+ " Adjustment reaction 0.00 0.00 0.00 1.0\n",
62
+ " Alcohol intoxication 0.00 0.00 0.00 0.0\n",
63
+ " Alcohol withdrawal 0.00 0.00 0.00 1.0\n",
64
+ " Alcoholic liver disease 0.00 0.00 0.00 0.0\n",
65
+ " Allergy 0.00 0.00 0.00 0.0\n",
66
+ " Allergy to animals 0.00 0.00 0.00 1.0\n",
67
+ " Anemia due to chronic kidney disease 0.00 0.00 0.00 1.0\n",
68
+ " Anemia of chronic disease 0.00 0.00 0.00 1.0\n",
69
+ " Angina 0.00 0.00 0.00 0.0\n",
70
+ " Ankylosing spondylitis 0.00 0.00 0.00 0.0\n",
71
+ " Aphakia 0.00 0.00 0.00 0.0\n",
72
+ " Aphthous ulcer 0.00 0.00 0.00 1.0\n",
73
+ " Arthritis of the hip 0.00 0.00 0.00 1.0\n",
74
+ " Asthma 0.00 0.00 0.00 0.0\n",
75
+ " Atelectasis 0.00 0.00 0.00 0.0\n",
76
+ " Athlete's foot 0.00 0.00 0.00 1.0\n",
77
+ " Atonic bladder 0.00 0.00 0.00 0.0\n",
78
+ " Atrial fibrillation 0.00 0.00 0.00 0.0\n",
79
+ " Benign vaginal discharge (leukorrhea) 0.00 0.00 0.00 0.0\n",
80
+ " Bipolar disorder 0.00 0.00 0.00 1.0\n",
81
+ " Birth trauma 0.00 0.00 0.00 0.0\n",
82
+ " Bladder cancer 0.00 0.00 0.00 0.0\n",
83
+ " Breast cancer 0.00 0.00 0.00 1.0\n",
84
+ " Breast cyst 0.00 0.00 0.00 0.0\n",
85
+ " Bursitis 0.00 0.00 0.00 1.0\n",
86
+ " Carbon monoxide poisoning 0.00 0.00 0.00 0.0\n",
87
+ " Cellulitis or abscess of mouth 0.00 0.00 0.00 1.0\n",
88
+ " Cervicitis 0.00 0.00 0.00 0.0\n",
89
+ " Chalazion 0.00 0.00 0.00 0.0\n",
90
+ " Cholecystitis 0.00 0.00 0.00 0.0\n",
91
+ " Choledocholithiasis 0.00 0.00 0.00 0.0\n",
92
+ " Cholesteatoma 0.00 0.00 0.00 0.0\n",
93
+ " Chondromalacia of the patella 0.00 0.00 0.00 0.0\n",
94
+ " Chronic back pain 0.00 0.00 0.00 0.0\n",
95
+ " Chronic glaucoma 0.00 0.00 0.00 1.0\n",
96
+ " Chronic kidney disease 0.00 0.00 0.00 0.0\n",
97
+ " Chronic knee pain 0.00 0.00 0.00 0.0\n",
98
+ " Chronic obstructive pulmonary disease (COPD) 0.00 0.00 0.00 0.0\n",
99
+ " Chronic otitis media 0.00 0.00 0.00 1.0\n",
100
+ " Chronic pain disorder 0.00 0.00 0.00 1.0\n",
101
+ " Chronic pancreatitis 0.00 0.00 0.00 1.0\n",
102
+ " Chronic rheumatic fever 0.00 0.00 0.00 0.0\n",
103
+ " Chronic ulcer 0.00 0.00 0.00 0.0\n",
104
+ " Cirrhosis 0.00 0.00 0.00 1.0\n",
105
+ " Cold sore 0.00 0.00 0.00 0.0\n",
106
+ " Colorectal cancer 0.00 0.00 0.00 0.0\n",
107
+ " Congenital rubella 0.00 0.00 0.00 1.0\n",
108
+ " Conjunctivitis due to allergy 0.00 0.00 0.00 1.0\n",
109
+ " Coronary atherosclerosis 0.00 0.00 0.00 1.0\n",
110
+ " Croup 0.00 0.00 0.00 0.0\n",
111
+ " Crushing injury 0.00 0.00 0.00 1.0\n",
112
+ " Cyst of the eyelid 0.00 0.00 0.00 1.0\n",
113
+ " Cystic Fibrosis 0.00 0.00 0.00 1.0\n",
114
+ " Cytomegalovirus infection 0.00 0.00 0.00 1.0\n",
115
+ " De Quervain disease 0.00 0.00 0.00 1.0\n",
116
+ " Degenerative disc disease 0.00 0.00 0.00 1.0\n",
117
+ " Dengue fever 0.00 0.00 0.00 0.0\n",
118
+ " Depression 0.00 0.00 0.00 0.0\n",
119
+ " Diabetes insipidus 0.00 0.00 0.00 1.0\n",
120
+ " Diaper rash 0.00 0.00 0.00 0.0\n",
121
+ " Dislocation of the ankle 0.00 0.00 0.00 0.0\n",
122
+ " Dislocation of the finger 0.00 0.00 0.00 1.0\n",
123
+ " Dislocation of the foot 0.00 0.00 0.00 1.0\n",
124
+ " Dislocation of the hip 0.00 0.00 0.00 1.0\n",
125
+ " Dislocation of the shoulder 0.00 0.00 0.00 0.0\n",
126
+ " Dissociative disorder 0.00 0.00 0.00 1.0\n",
127
+ " Down syndrome 0.00 0.00 0.00 1.0\n",
128
+ " Drug abuse (cocaine) 0.00 0.00 0.00 0.0\n",
129
+ " Drug reaction 0.00 0.00 0.00 1.0\n",
130
+ " Dyshidrosis 0.00 0.00 0.00 1.0\n",
131
+ " Ear drum damage 0.00 0.00 0.00 0.0\n",
132
+ " Ear wax impaction 0.00 0.00 0.00 1.0\n",
133
+ " Emphysema 0.00 0.00 0.00 0.0\n",
134
+ " Empyema 0.00 0.00 0.00 1.0\n",
135
+ " Encephalitis 0.00 0.00 0.00 0.0\n",
136
+ " Endocarditis 0.00 0.00 0.00 1.0\n",
137
+ " Endometrial hyperplasia 0.00 0.00 0.00 1.0\n",
138
+ " Esophageal cancer 0.00 0.00 0.00 0.0\n",
139
+ " Essential tremor 0.00 0.00 0.00 1.0\n",
140
+ " Factitious disorder 0.00 0.00 0.00 1.0\n",
141
+ " Fat embolism 0.00 0.00 0.00 1.0\n",
142
+ " Female genitalia infection 0.00 0.00 0.00 1.0\n",
143
+ " Fibroadenoma 0.00 0.00 0.00 1.0\n",
144
+ " Fibromyalgia 0.00 0.00 0.00 0.0\n",
145
+ " Floaters 0.00 0.00 0.00 0.0\n",
146
+ " Fluid overload 0.00 0.00 0.00 1.0\n",
147
+ " Foreign body in the eye 0.00 0.00 0.00 0.0\n",
148
+ " Foreign body in the throat 0.00 0.00 0.00 0.0\n",
149
+ " Foreign body in the vagina 0.00 0.00 0.00 0.0\n",
150
+ " Fracture of the ankle 0.00 0.00 0.00 1.0\n",
151
+ " Fracture of the arm 0.00 0.00 0.00 1.0\n",
152
+ " Fracture of the finger 0.00 0.00 0.00 0.0\n",
153
+ " Fracture of the hand 0.00 0.00 0.00 0.0\n",
154
+ " Fracture of the jaw 0.00 0.00 0.00 1.0\n",
155
+ " Fracture of the leg 0.00 0.00 0.00 0.0\n",
156
+ " Fracture of the patella 0.00 0.00 0.00 1.0\n",
157
+ " G6PD enzyme deficiency 0.00 0.00 0.00 0.0\n",
158
+ " Galactorrhea of unknown cause 0.00 0.00 0.00 0.0\n",
159
+ " Gallstone 0.00 0.00 0.00 0.0\n",
160
+ " Gastritis 0.00 0.00 0.00 0.0\n",
161
+ " Gastroduodenal ulcer 0.00 0.00 0.00 1.0\n",
162
+ " Gout 0.00 0.00 0.00 0.0\n",
163
+ " Granuloma inguinale 0.00 0.00 0.00 0.0\n",
164
+ " Gynecomastia 0.00 0.00 0.00 0.0\n",
165
+ " Hashimoto thyroiditis 0.00 0.00 0.00 1.0\n",
166
+ " Head and neck cancer 0.00 0.00 0.00 1.0\n",
167
+ " Heart attack 0.00 0.00 0.00 1.0\n",
168
+ " Heart contusion 0.00 0.00 0.00 0.0\n",
169
+ " Heart failure 0.00 0.00 0.00 1.0\n",
170
+ " Hemarthrosis 0.00 0.00 0.00 1.0\n",
171
+ " Hematoma 0.00 0.00 0.00 1.0\n",
172
+ " Hemolytic anemia 0.00 0.00 0.00 1.0\n",
173
+ " Hemorrhagic fever 0.00 0.00 0.00 0.0\n",
174
+ " High blood pressure 0.00 0.00 0.00 0.0\n",
175
+ " Hirsutism 0.00 0.00 0.00 1.0\n",
176
+ " Human immunodeficiency virus infection (HIV) 0.00 0.00 0.00 1.0\n",
177
+ " Hydatidiform mole 0.00 0.00 0.00 1.0\n",
178
+ " Hydrocele of the testicle 0.00 0.00 0.00 0.0\n",
179
+ " Hydronephrosis 0.00 0.00 0.00 1.0\n",
180
+ " Hyperemesis gravidarum 0.00 0.00 0.00 0.0\n",
181
+ " Hypergammaglobulinemia 0.00 0.00 0.00 1.0\n",
182
+ " Hyperkalemia 0.00 0.00 0.00 0.0\n",
183
+ " Hypernatremia 0.00 0.00 0.00 1.0\n",
184
+ "Hypertrophic obstructive cardiomyopathy (HOCM) 0.00 0.00 0.00 1.0\n",
185
+ " Hyponatremia 0.00 0.00 0.00 0.0\n",
186
+ " Impetigo 0.00 0.00 0.00 1.0\n",
187
+ " Indigestion 0.00 0.00 0.00 1.0\n",
188
+ " Infectious gastroenteritis 0.00 0.00 0.00 1.0\n",
189
+ " Ingrown toe nail 0.00 0.00 0.00 1.0\n",
190
+ " Inguinal hernia 0.00 0.00 0.00 0.0\n",
191
+ " Injury of the ankle 0.00 0.00 0.00 0.0\n",
192
+ " Injury to the abdomen 0.00 0.00 0.00 1.0\n",
193
+ " Injury to the arm 0.00 0.00 0.00 0.0\n",
194
+ " Injury to the finger 0.00 0.00 0.00 1.0\n",
195
+ " Injury to the hand 0.00 0.00 0.00 0.0\n",
196
+ " Injury to the hip 0.00 0.00 0.00 1.0\n",
197
+ " Insect bite 0.00 0.00 0.00 0.0\n",
198
+ " Intestinal cancer 0.00 0.00 0.00 1.0\n",
199
+ " Intestinal malabsorption 0.00 0.00 0.00 1.0\n",
200
+ " Intestinal obstruction 0.00 0.00 0.00 0.0\n",
201
+ " Intracranial abscess 0.00 0.00 0.00 1.0\n",
202
+ " Irritable bowel syndrome 0.00 0.00 0.00 0.0\n",
203
+ " Kaposi sarcoma 0.00 0.00 0.00 1.0\n",
204
+ " Kidney cancer 0.00 0.00 0.00 1.0\n",
205
+ " Kidney stone 0.00 0.00 0.00 1.0\n",
206
+ " Knee ligament or meniscus tear 0.00 0.00 0.00 1.0\n",
207
+ " Lactose intolerance 0.00 0.00 0.00 1.0\n",
208
+ " Leishmaniasis 0.00 0.00 0.00 1.0\n",
209
+ " Lichen planus 0.00 0.00 0.00 1.0\n",
210
+ " Lipoma 0.00 0.00 0.00 1.0\n",
211
+ " Lung cancer 0.00 0.00 0.00 1.0\n",
212
+ " Lymphadenitis 0.00 0.00 0.00 0.0\n",
213
+ " Lymphangitis 0.00 0.00 0.00 1.0\n",
214
+ " Lymphogranuloma venereum 0.00 0.00 0.00 1.0\n",
215
+ " Magnesium deficiency 0.00 0.00 0.00 1.0\n",
216
+ " Malignant hypertension 0.00 0.00 0.00 1.0\n",
217
+ " Marijuana abuse 0.00 0.00 0.00 0.0\n",
218
+ " Mastoiditis 0.00 0.00 0.00 1.0\n",
219
+ " Meckel diverticulum 0.00 0.00 0.00 0.0\n",
220
+ " Migraine 0.00 0.00 0.00 1.0\n",
221
+ " Mitral valve disease 0.00 0.00 0.00 1.0\n",
222
+ " Molluscum contagiosum 0.00 0.00 0.00 1.0\n",
223
+ " Mononucleosis 0.00 0.00 0.00 0.0\n",
224
+ " Moyamoya disease 0.00 0.00 0.00 0.0\n",
225
+ " Mucositis 0.00 0.00 0.00 0.0\n",
226
+ " Mumps 0.00 0.00 0.00 1.0\n",
227
+ " Muscle spasm 0.00 0.00 0.00 1.0\n",
228
+ " Narcolepsy 0.00 0.00 0.00 0.0\n",
229
+ " Neonatal jaundice 0.00 0.00 0.00 1.0\n",
230
+ " Neurosis 0.00 0.00 0.00 0.0\n",
231
+ " Noninfectious gastroenteritis 0.00 0.00 0.00 0.0\n",
232
+ " Obstructive sleep apnea (OSA) 0.00 0.00 0.00 1.0\n",
233
+ " Onychomycosis 0.00 0.00 0.00 0.0\n",
234
+ " Open wound of the cheek 0.00 0.00 0.00 1.0\n",
235
+ " Open wound of the finger 0.00 0.00 0.00 0.0\n",
236
+ " Open wound of the hand 0.00 0.00 0.00 1.0\n",
237
+ " Open wound of the head 0.00 0.00 0.00 1.0\n",
238
+ " Open wound of the hip 0.00 0.00 0.00 0.0\n",
239
+ " Open wound of the mouth 0.00 0.00 0.00 1.0\n",
240
+ " Open wound of the neck 0.00 0.00 0.00 1.0\n",
241
+ " Oral leukoplakia 0.00 0.00 0.00 0.0\n",
242
+ " Oral mucosal lesion 0.00 0.00 0.00 0.0\n",
243
+ " Oral thrush (yeast infection) 0.00 0.00 0.00 1.0\n",
244
+ " Osteoarthritis 0.00 0.00 0.00 0.0\n",
245
+ " Otitis externa (swimmer's ear) 0.00 0.00 0.00 0.0\n",
246
+ " Pancreatic cancer 0.00 0.00 0.00 1.0\n",
247
+ " Panic disorder 0.00 0.00 0.00 0.0\n",
248
+ " Parkinson disease 0.00 0.00 0.00 0.0\n",
249
+ " Paronychia 0.00 0.00 0.00 0.0\n",
250
+ " Patau syndrome 0.00 0.00 0.00 0.0\n",
251
+ " Pelvic fistula 0.00 0.00 0.00 1.0\n",
252
+ " Pelvic organ prolapse 0.00 0.00 0.00 0.0\n",
253
+ " Pemphigus 0.00 0.00 0.00 0.0\n",
254
+ " Pericarditis 0.00 0.00 0.00 1.0\n",
255
+ " Perirectal infection 0.00 0.00 0.00 1.0\n",
256
+ " Peritonsillar abscess 0.00 0.00 0.00 1.0\n",
257
+ " Personality disorder 0.00 0.00 0.00 0.0\n",
258
+ " Phimosis 0.00 0.00 0.00 1.0\n",
259
+ " Pilonidal cyst 0.00 0.00 0.00 1.0\n",
260
+ " Placental abruption 0.00 0.00 0.00 1.0\n",
261
+ " Pleural effusion 0.00 0.00 0.00 1.0\n",
262
+ " Pneumonia 0.00 0.00 0.00 0.0\n",
263
+ " Pneumothorax 0.00 0.00 0.00 1.0\n",
264
+ " Poisoning due to analgesics 0.00 0.00 0.00 1.0\n",
265
+ " Poisoning due to antidepressants 0.00 0.00 0.00 0.0\n",
266
+ " Polycystic ovarian syndrome (PCOS) 0.00 0.00 0.00 0.0\n",
267
+ " Premature ovarian failure 0.00 0.00 0.00 1.0\n",
268
+ " Premenstrual tension syndrome 0.00 0.00 0.00 0.0\n",
269
+ " Problem during pregnancy 0.00 0.00 0.00 0.0\n",
270
+ " Protein deficiency 0.00 0.00 0.00 0.0\n",
271
+ " Pseudohypoparathyroidism 0.00 0.00 0.00 1.0\n",
272
+ " Psoriasis 0.00 0.00 0.00 0.0\n",
273
+ " Psychotic disorder 0.00 0.00 0.00 1.0\n",
274
+ " Pulmonary embolism 0.00 0.00 0.00 0.0\n",
275
+ " Pulmonary eosinophilia 0.00 0.00 0.00 1.0\n",
276
+ " Pulmonary fibrosis 0.00 0.00 0.00 0.0\n",
277
+ " Pyelonephritis 0.00 0.00 0.00 0.0\n",
278
+ " Pyloric stenosis 0.00 0.00 0.00 1.0\n",
279
+ " Reactive arthritis 0.00 0.00 0.00 1.0\n",
280
+ " Sarcoidosis 0.00 0.00 0.00 1.0\n",
281
+ " Scarlet fever 0.00 0.00 0.00 1.0\n",
282
+ " Sciatica 0.00 0.00 0.00 0.0\n",
283
+ " Scoliosis 0.00 0.00 0.00 1.0\n",
284
+ " Scurvy 0.00 0.00 0.00 1.0\n",
285
+ " Sebaceous cyst 0.00 0.00 0.00 0.0\n",
286
+ " Sepsis 0.00 0.00 0.00 1.0\n",
287
+ " Septic arthritis 0.00 0.00 0.00 1.0\n",
288
+ " Shingles (herpes zoster) 0.00 0.00 0.00 0.0\n",
289
+ " Sickle cell crisis 0.00 0.00 0.00 1.0\n",
290
+ " Sjogren syndrome 0.00 0.00 0.00 1.0\n",
291
+ " Skin pigmentation disorder 0.00 0.00 0.00 1.0\n",
292
+ " Smoking or tobacco addiction 0.00 0.00 0.00 1.0\n",
293
+ " Spermatocele 0.00 0.00 0.00 1.0\n",
294
+ " Spondylitis 0.00 0.00 0.00 0.0\n",
295
+ " Spondylolisthesis 0.00 0.00 0.00 1.0\n",
296
+ " Spondylosis 0.00 0.00 0.00 0.0\n",
297
+ " Sporotrichosis 0.00 0.00 0.00 1.0\n",
298
+ " Sprain or strain 0.00 0.00 0.00 0.0\n",
299
+ " Stenosis of the tear duct 0.00 0.00 0.00 1.0\n",
300
+ " Strep throat 0.00 0.00 0.00 1.0\n",
301
+ " Stress incontinence 0.00 0.00 0.00 1.0\n",
302
+ " Stroke 0.00 0.00 0.00 1.0\n",
303
+ " Subarachnoid hemorrhage 0.00 0.00 0.00 1.0\n",
304
+ " Subconjunctival hemorrhage 0.00 0.00 0.00 1.0\n",
305
+ " Tendinitis 0.00 0.00 0.00 1.0\n",
306
+ " Testicular torsion 0.00 0.00 0.00 1.0\n",
307
+ " Thoracic aortic aneurysm 0.00 0.00 0.00 1.0\n",
308
+ " Tietze syndrome 0.00 0.00 0.00 0.0\n",
309
+ " Tonsillar hypertrophy 0.00 0.00 0.00 1.0\n",
310
+ " Tonsillitis 0.00 0.00 0.00 0.0\n",
311
+ " Tooth abscess 0.00 0.00 0.00 0.0\n",
312
+ " Tooth disorder 0.00 0.00 0.00 0.0\n",
313
+ " Torticollis 0.00 0.00 0.00 1.0\n",
314
+ " Tourette syndrome 0.00 0.00 0.00 1.0\n",
315
+ " Toxoplasmosis 0.00 0.00 0.00 1.0\n",
316
+ " Tracheitis 0.00 0.00 0.00 1.0\n",
317
+ " Transient ischemic attack 0.00 0.00 0.00 0.0\n",
318
+ " Trichinosis 0.00 0.00 0.00 1.0\n",
319
+ " Trichomonas infection 0.00 0.00 0.00 1.0\n",
320
+ " Tricuspid valve disease 0.00 0.00 0.00 1.0\n",
321
+ " Turner syndrome 0.00 0.00 0.00 1.0\n",
322
+ " Urethral stricture 0.00 0.00 0.00 0.0\n",
323
+ " Urge incontinence 0.00 0.00 0.00 1.0\n",
324
+ " Urinary tract obstruction 0.00 0.00 0.00 0.0\n",
325
+ " Vaginal yeast infection 0.00 0.00 0.00 0.0\n",
326
+ " Vaginitis 0.00 0.00 0.00 0.0\n",
327
+ " Varicocele of the testicles 0.00 0.00 0.00 1.0\n",
328
+ " Viral exanthem 0.00 0.00 0.00 1.0\n",
329
+ " Viral warts 0.00 0.00 0.00 0.0\n",
330
+ " Vitamin A deficiency 0.00 0.00 0.00 1.0\n",
331
+ " Vitreous degeneration 0.00 0.00 0.00 0.0\n",
332
+ " Vulvar cancer 0.00 0.00 0.00 1.0\n",
333
+ " Vulvar disorder 0.00 0.00 0.00 1.0\n",
334
+ " Vulvodynia 0.00 0.00 0.00 1.0\n",
335
+ " West Nile virus 0.00 0.00 0.00 1.0\n",
336
+ " Whooping cough 0.00 0.00 0.00 0.0\n",
337
+ " Wilson disease 0.00 0.00 0.00 0.0\n",
338
+ "\n",
339
+ " accuracy 0.00 160.0\n",
340
+ " macro avg 0.00 0.00 0.00 160.0\n",
341
+ " weighted avg 0.00 0.00 0.00 160.0\n",
342
+ "\n"
343
+ ]
344
+ },
345
+ {
346
+ "output_type": "stream",
347
+ "name": "stderr",
348
+ "text": [
349
+ "/usr/local/lib/python3.8/dist-packages/sklearn/metrics/_classification.py:1318: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n",
350
+ " _warn_prf(average, modifier, msg_start, len(result))\n",
351
+ "/usr/local/lib/python3.8/dist-packages/sklearn/metrics/_classification.py:1318: UndefinedMetricWarning: Recall and F-score are ill-defined and being set to 0.0 in labels with no true samples. Use `zero_division` parameter to control this behavior.\n",
352
+ " _warn_prf(average, modifier, msg_start, len(result))\n",
353
+ "/usr/local/lib/python3.8/dist-packages/sklearn/metrics/_classification.py:1318: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n",
354
+ " _warn_prf(average, modifier, msg_start, len(result))\n",
355
+ "/usr/local/lib/python3.8/dist-packages/sklearn/metrics/_classification.py:1318: UndefinedMetricWarning: Recall and F-score are ill-defined and being set to 0.0 in labels with no true samples. Use `zero_division` parameter to control this behavior.\n",
356
+ " _warn_prf(average, modifier, msg_start, len(result))\n",
357
+ "/usr/local/lib/python3.8/dist-packages/sklearn/metrics/_classification.py:1318: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n",
358
+ " _warn_prf(average, modifier, msg_start, len(result))\n",
359
+ "/usr/local/lib/python3.8/dist-packages/sklearn/metrics/_classification.py:1318: UndefinedMetricWarning: Recall and F-score are ill-defined and being set to 0.0 in labels with no true samples. Use `zero_division` parameter to control this behavior.\n",
360
+ " _warn_prf(average, modifier, msg_start, len(result))\n"
361
+ ]
362
+ }
363
+ ],
364
+ "source": [
365
+ "import pandas as pd\n",
366
+ "import re\n",
367
+ "import spacy\n",
368
+ "from sklearn.model_selection import train_test_split\n",
369
+ "from sklearn.feature_extraction.text import TfidfVectorizer\n",
370
+ "from sklearn.pipeline import Pipeline\n",
371
+ "from sklearn.metrics import accuracy_score, classification_report\n",
372
+ "from sklearn.linear_model import LogisticRegression\n",
373
+ "\n",
374
+ "# Load the data\n",
375
+ "data = pd.read_csv('symptomssingle.csv')\n",
376
+ "\n",
377
+ "# Check for any missing values and remove them\n",
378
+ "data = data.dropna()\n",
379
+ "\n",
380
+ "# Define a function to separate symptoms and diseases from the text\n",
381
+ "def separate_symptoms_and_diseases(text):\n",
382
+ " symptoms = re.findall(r'{\"symptoms\":\"(.*?)\"}', text)\n",
383
+ " disease = re.sub(r'(?:{\"symptoms\":\".*?\"},?)+', '', text).strip()\n",
384
+ " disease = disease.replace('],', '').strip() # Remove '],' from the disease name\n",
385
+ " return symptoms, disease\n",
386
+ "\n",
387
+ "# Apply the function to the data\n",
388
+ "data['symptoms_and_diseases'] = data['data'].apply(separate_symptoms_and_diseases)\n",
389
+ "data[['symptoms', 'disease']] = pd.DataFrame(data['symptoms_and_diseases'].tolist(), index=data.index)\n",
390
+ "data = data.drop(columns=['data', 'symptoms_and_diseases'])\n",
391
+ "\n",
392
+ "# Load the spaCy model\n",
393
+ "nlp = spacy.load('en_core_web_sm')\n",
394
+ "\n",
395
+ "# Preprocessing function\n",
396
+ "def preprocess(symptoms):\n",
397
+ " processed_symptoms = []\n",
398
+ " for symptom in symptoms:\n",
399
+ " doc = nlp(symptom)\n",
400
+ " processed_symptom = ' '.join(token.lemma_.lower() for token in doc if not token.is_stop and token.is_alpha)\n",
401
+ " processed_symptoms.append(processed_symptom)\n",
402
+ " return ' '.join(processed_symptoms)\n",
403
+ "\n",
404
+ "# Preprocess the symptoms column\n",
405
+ "data['symptoms_preprocessed'] = data['symptoms'].apply(preprocess)\n",
406
+ "\n",
407
+ "\n",
408
+ "# Split the data into train and test sets\n",
409
+ "X_train, X_test, y_train, y_test = train_test_split(data['symptoms_preprocessed'], data['disease'], test_size=0.2, random_state=42)\n",
410
+ "\n",
411
+ "# Create a pipeline for text classification\n",
412
+ "pipeline = Pipeline([\n",
413
+ " ('tfidf', TfidfVectorizer(ngram_range=(1, 2))),\n",
414
+ " ('classifier', LogisticRegression(solver='liblinear', C=10))\n",
415
+ "])\n",
416
+ "\n",
417
+ "# Train the model\n",
418
+ "pipeline.fit(X_train, y_train)\n",
419
+ "\n",
420
+ "# Make predictions\n",
421
+ "y_pred = pipeline.predict(X_test)\n",
422
+ "\n",
423
+ "# Evaluate the model\n",
424
+ "print(\"Accuracy: \", accuracy_score(y_test, y_pred))\n",
425
+ "print(\"Classification Report:\\n\", classification_report(y_test, y_pred))\n"
426
+ ]
427
+ },
428
+ {
429
+ "cell_type": "code",
430
+ "source": [
431
+ "!pip install joblib\n",
432
+ "import joblib\n",
433
+ "\n",
434
+ "# Save the trained model\n",
435
+ "joblib.dump(pipeline, 'DiseasePredictionBasedonSymptoms.joblib')\n"
436
+ ],
437
+ "metadata": {
438
+ "colab": {
439
+ "base_uri": "https://localhost:8080/"
440
+ },
441
+ "id": "emwnJJVwAupA",
442
+ "outputId": "83b9dc69-243d-48fe-8554-533cbf61866a"
443
+ },
444
+ "execution_count": null,
445
+ "outputs": [
446
+ {
447
+ "output_type": "stream",
448
+ "name": "stdout",
449
+ "text": [
450
+ "Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
451
+ "Requirement already satisfied: joblib in /usr/local/lib/python3.8/dist-packages (1.2.0)\n"
452
+ ]
453
+ },
454
+ {
455
+ "output_type": "execute_result",
456
+ "data": {
457
+ "text/plain": [
458
+ "['DiseasePredictionBasedonSymptoms.joblib']"
459
+ ]
460
+ },
461
+ "metadata": {},
462
+ "execution_count": 2
463
+ }
464
+ ]
465
+ },
466
+ {
467
+ "cell_type": "code",
468
+ "source": [
469
+ "import joblib\n",
470
+ "\n",
471
+ "# Load the saved model\n",
472
+ "loaded_pipeline = joblib.load('DiseasePredictionBasedonSymptoms.joblib')\n",
473
+ "\n",
474
+ "# Make predictions using the loaded model (example)\n",
475
+ "sample_symptom = input('Enter a symptom : ')\n",
476
+ "processed_symptom = preprocess([sample_symptom])\n",
477
+ "prediction = loaded_pipeline.predict([processed_symptom])\n",
478
+ "\n",
479
+ "print(\"Predicted disease:\", prediction[0])\n"
480
+ ],
481
+ "metadata": {
482
+ "colab": {
483
+ "base_uri": "https://localhost:8080/"
484
+ },
485
+ "id": "Tu4fmj1bBYNw",
486
+ "outputId": "8ceceb89-7e77-44b5-dca7-66b79a68f582"
487
+ },
488
+ "execution_count": null,
489
+ "outputs": [
490
+ {
491
+ "output_type": "stream",
492
+ "name": "stdout",
493
+ "text": [
494
+ "Enter a symptom : Weight gain\n",
495
+ "Predicted disease: Diabetes\n"
496
+ ]
497
+ }
498
+ ]
499
+ },
500
+ {
501
+ "cell_type": "code",
502
+ "source": [],
503
+ "metadata": {
504
+ "id": "CY5qrRCkBGuJ"
505
+ },
506
+ "execution_count": null,
507
+ "outputs": []
508
+ }
509
+ ]
510
+ }
symptomssingle.csv ADDED
The diff for this file is too large to render. See raw diff