Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2022-005
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Samadhi IT19145730
2022-005
Commits
506c50d7
Commit
506c50d7
authored
Oct 09, 2022
by
Samadhi IT19145730
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete Symthom_Checker.ipynb
parent
a3ed97eb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
455 deletions
+0
-455
Symthom_Checker.ipynb
Symthom_Checker.ipynb
+0
-455
No files found.
Symthom_Checker.ipynb
deleted
100644 → 0
View file @
a3ed97eb
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "6c32ee61",
"metadata": {},
"outputs": [],
"source": [
"# from tkinter import *\n",
"from tkinter import messagebox\n",
"import numpy as np\n",
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 54,
"id": "3b5f7d1b",
"metadata": {},
"outputs": [],
"source": [
"l1=['itching','skin_rash','nodal_skin_eruptions','continuous_sneezing','shivering','chills','joint_pain',\n",
" 'stomach_pain','acidity','ulcers_on_tongue','muscle_wasting','vomiting','burning_micturition','spotting_ urination','fatigue',\n",
" 'weight_gain','anxiety','cold_hands_and_feets','mood_swings','weight_loss','restlessness','lethargy','patches_in_throat',\n",
" 'irregular_sugar_level','cough','high_fever','sunken_eyes','breathlessness','sweating','dehydration','indigestion',\n",
" 'headache','yellowish_skin','dark_urine','nausea','loss_of_appetite','pain_behind_the_eyes','back_pain','constipation',\n",
" 'abdominal_pain','diarrhoea','mild_fever','yellow_urine','yellowing_of_eyes','acute_liver_failure','fluid_overload',\n",
" 'swelling_of_stomach','swelled_lymph_nodes','malaise','blurred_and_distorted_vision','phlegm','throat_irritation',\n",
" 'redness_of_eyes','sinus_pressure','runny_nose','congestion','chest_pain','weakness_in_limbs','fast_heart_rate',\n",
" 'pain_during_bowel_movements','pain_in_anal_region','bloody_stool','irritation_in_anus','neck_pain','dizziness','cramps',\n",
" 'bruising','obesity','swollen_legs','swollen_blood_vessels','puffy_face_and_eyes','enlarged_thyroid','brittle_nails',\n",
" 'swollen_extremeties','excessive_hunger','extra_marital_contacts','drying_and_tingling_lips','slurred_speech','knee_pain','hip_joint_pain',\n",
" 'muscle_weakness','stiff_neck','swelling_joints','movement_stiffness','spinning_movements','loss_of_balance','unsteadiness','weakness_of_one_body_side',\n",
" 'loss_of_smell','bladder_discomfort','foul_smell_of urine','continuous_feel_of_urine','passage_of_gases','internal_itching','toxic_look_(typhos)',\n",
" 'depression','irritability','muscle_pain','altered_sensorium','red_spots_over_body','belly_pain','abnormal_menstruation','dischromic _patches',\n",
" 'watering_from_eyes','increased_appetite','polyuria','family_history','mucoid_sputum','rusty_sputum','lack_of_concentration','visual_disturbances',\n",
" 'receiving_blood_transfusion','receiving_unsterile_injections','coma','stomach_bleeding','distention_of_abdomen','history_of_alcohol_consumption',\n",
" 'fluid_overload','blood_in_sputum','prominent_veins_on_calf','palpitations','painful_walking','pus_filled_pimples','blackheads','scurring','skin_peeling',\n",
" 'silver_like_dusting','small_dents_in_nails','inflammatory_nails','blister','red_sore_around_nose','yellow_crust_ooze']"
]
},
{
"cell_type": "code",
"execution_count": 55,
"id": "2d922e2c",
"metadata": {},
"outputs": [],
"source": [
"disease=['Fungal infection','Allergy','GERD','Chronic cholestasis','Drug Reaction',\n",
" 'Peptic ulcer diseae','AIDS','Diabetes','Gastroenteritis','Bronchial Asthma','Hypertension',\n",
" ' Migraine','Cervical spondylosis',\n",
" 'Paralysis (brain hemorrhage)','Jaundice','Malaria','Chicken pox','Dengue','Typhoid','hepatitis A',\n",
"'Hepatitis B','Hepatitis C','Hepatitis D','Hepatitis E','Alcoholic hepatitis','Tuberculosis',\n",
"'Common Cold','Pneumonia','Dimorphic hemmorhoids(piles)',\n",
"'Heartattack','Varicoseveins','Hypothyroidism','Hyperthyroidism','Hypoglycemia','Osteoarthristis',\n",
"'Arthritis','(vertigo) Paroymsal Positional Vertigo','Acne','Urinary tract infection','Psoriasis',\n",
"'Impetigo']"
]
},
{
"cell_type": "code",
"execution_count": 56,
"id": "1193c99f",
"metadata": {},
"outputs": [],
"source": [
"l2=[]\n",
"for x in range(0,len(l1)):\n",
" l2.append(0)"
]
},
{
"cell_type": "code",
"execution_count": 57,
"id": "3e64d7e5",
"metadata": {},
"outputs": [],
"source": [
"# TESTING DATA\n",
"tr=pd.read_csv(\"Testing.csv\")\n",
"tr.replace({'prognosis':{'Fungal infection':0,'Allergy':1,'GERD':2,'Chronic cholestasis':3,'Drug Reaction':4,\n",
"'Peptic ulcer diseae':5,'AIDS':6,'Diabetes ':7,'Gastroenteritis':8,'Bronchial Asthma':9,'Hypertension ':10,\n",
"'Migraine':11,'Cervical spondylosis':12,\n",
"'Paralysis (brain hemorrhage)':13,'Jaundice':14,'Malaria':15,'Chicken pox':16,'Dengue':17,'Typhoid':18,'hepatitis A':19,\n",
"'Hepatitis B':20,'Hepatitis C':21,'Hepatitis D':22,'Hepatitis E':23,'Alcoholic hepatitis':24,'Tuberculosis':25,\n",
"'Common Cold':26,'Pneumonia':27,'Dimorphic hemmorhoids(piles)':28,'Heart attack':29,'Varicose veins':30,'Hypothyroidism':31,\n",
"'Hyperthyroidism':32,'Hypoglycemia':33,'Osteoarthristis':34,'Arthritis':35,\n",
"'(vertigo) Paroymsal Positional Vertigo':36,'Acne':37,'Urinary tract infection':38,'Psoriasis':39,\n",
"'Impetigo':40}},inplace=True)"
]
},
{
"cell_type": "code",
"execution_count": 58,
"id": "a1bc03c5",
"metadata": {},
"outputs": [],
"source": [
"# tr"
]
},
{
"cell_type": "code",
"execution_count": 59,
"id": "cc856b5a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,\n",
" 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,\n",
" 34, 35, 36, 37, 38, 39, 40], dtype=int64)"
]
},
"execution_count": 59,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"X_test= tr[l1]\n",
"y_test = tr[[\"prognosis\"]]\n",
"np.ravel(y_test)"
]
},
{
"cell_type": "code",
"execution_count": 60,
"id": "7f5df428",
"metadata": {},
"outputs": [],
"source": [
"# TRAINING DATA\n",
"df=pd.read_csv(\"Training.csv\")"
]
},
{
"cell_type": "code",
"execution_count": 61,
"id": "6d9d4db9",
"metadata": {},
"outputs": [],
"source": [
"df.replace({'prognosis':{'Fungal infection':0,'Allergy':1,'GERD':2,'Chronic cholestasis':3,'Drug Reaction':4,\n",
"'Peptic ulcer diseae':5,'AIDS':6,'Diabetes ':7,'Gastroenteritis':8,'Bronchial Asthma':9,'Hypertension ':10,\n",
"'Migraine':11,'Cervical spondylosis':12,\n",
"'Paralysis (brain hemorrhage)':13,'Jaundice':14,'Malaria':15,'Chicken pox':16,'Dengue':17,'Typhoid':18,'hepatitis A':19,\n",
"'Hepatitis B':20,'Hepatitis C':21,'Hepatitis D':22,'Hepatitis E':23,'Alcoholic hepatitis':24,'Tuberculosis':25,\n",
"'Common Cold':26,'Pneumonia':27,'Dimorphic hemmorhoids(piles)':28,'Heart attack':29,'Varicose veins':30,'Hypothyroidism':31,\n",
"'Hyperthyroidism':32,'Hypoglycemia':33,'Osteoarthristis':34,'Arthritis':35,\n",
"'(vertigo) Paroymsal Positional Vertigo':36,'Acne':37,'Urinary tract infection':38,'Psoriasis':39,\n",
"'Impetigo':40}},inplace=True)"
]
},
{
"cell_type": "code",
"execution_count": 62,
"id": "1220837a",
"metadata": {},
"outputs": [],
"source": [
"X= df[l1]"
]
},
{
"cell_type": "code",
"execution_count": 63,
"id": "731a2d2f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([ 0, 0, 0, ..., 38, 39, 40], dtype=int64)"
]
},
"execution_count": 63,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"y = df[[\"prognosis\"]]\n",
"np.ravel(y)"
]
},
{
"cell_type": "code",
"execution_count": 64,
"id": "b7e370fd",
"metadata": {},
"outputs": [],
"source": [
"def message():\n",
" if (Symptom1.get() == \"None\" and Symptom2.get() == \"None\" and Symptom3.get() == \"None\" and Symptom4.get() == \"None\" and Symptom5.get() == \"None\"):\n",
" messagebox.showinfo(\"OPPS!!\", \"ENTER SYMPTOMS PLEASE\")\n",
" else :\n",
" NaiveBayes()"
]
},
{
"cell_type": "code",
"execution_count": 65,
"id": "df488916",
"metadata": {},
"outputs": [],
"source": [
"def NaiveBayes():\n",
" from sklearn.naive_bayes import MultinomialNB\n",
" gnb = MultinomialNB()\n",
" gnb=gnb.fit(X,np.ravel(y))\n",
" from sklearn.metrics import accuracy_score\n",
" y_pred = gnb.predict(X_test)\n",
" print(accuracy_score(y_test, y_pred))\n",
" print(accuracy_score(y_test, y_pred, normalize=False))\n",
"\n",
" psymptoms = [Symptom1.get(),Symptom2.get(),Symptom3.get(),Symptom4.get(),Symptom5.get()]\n",
"\n",
" for k in range(0,len(l1)):\n",
" for z in psymptoms:\n",
" if(z==l1[k]):\n",
" l2[k]=1\n",
"\n",
" inputtest = [l2]\n",
" predict = gnb.predict(inputtest)\n",
" predicted=predict[0]\n",
"\n",
" h='no'\n",
" for a in range(0,len(disease)):\n",
" if(disease[predicted] == disease[a]):\n",
" h='yes'\n",
" break\n",
"\n",
" if (h=='yes'):\n",
" t3.delete(\"1.0\", END)\n",
" t3.insert(END, disease[a])\n",
" else:\n",
" t3.delete(\"1.0\", END)\n",
" t3.insert(END, \"No Disease\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1be3755a",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 66,
"id": "80eb0a7a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'bd': ('bd', '-borderwidth'),\n",
" 'borderwidth': ('borderwidth',\n",
" 'borderWidth',\n",
" 'BorderWidth',\n",
" <string object: '0'>,\n",
" 0),\n",
" 'class': ('class', 'class', 'Class', 'Toplevel', 'Tk'),\n",
" 'menu': ('menu', 'menu', 'Menu', '', ''),\n",
" 'relief': ('relief', 'relief', 'Relief', <string object: 'flat'>, 'flat'),\n",
" 'screen': ('screen', 'screen', 'Screen', '', ''),\n",
" 'use': ('use', 'use', 'Use', '', ''),\n",
" 'background': ('background',\n",
" 'background',\n",
" 'Background',\n",
" <string object: 'SystemButtonFace'>,\n",
" 'SystemButtonFace'),\n",
" 'bg': ('bg', '-background'),\n",
" 'colormap': ('colormap', 'colormap', 'Colormap', '', ''),\n",
" 'container': ('container', 'container', 'Container', 0, 0),\n",
" 'cursor': ('cursor', 'cursor', 'Cursor', '', ''),\n",
" 'height': ('height', 'height', 'Height', <string object: '0'>, 0),\n",
" 'highlightbackground': ('highlightbackground',\n",
" 'highlightBackground',\n",
" 'HighlightBackground',\n",
" <string object: 'SystemButtonFace'>,\n",
" 'SystemButtonFace'),\n",
" 'highlightcolor': ('highlightcolor',\n",
" 'highlightColor',\n",
" 'HighlightColor',\n",
" <string object: 'SystemWindowFrame'>,\n",
" 'SystemWindowFrame'),\n",
" 'highlightthickness': ('highlightthickness',\n",
" 'highlightThickness',\n",
" 'HighlightThickness',\n",
" <string object: '0'>,\n",
" 0),\n",
" 'padx': ('padx', 'padX', 'Pad', <string object: '0'>, <string object: '0'>),\n",
" 'pady': ('pady', 'padY', 'Pad', <string object: '0'>, <string object: '0'>),\n",
" 'takefocus': ('takefocus', 'takeFocus', 'TakeFocus', '0', '0'),\n",
" 'visual': ('visual', 'visual', 'Visual', '', ''),\n",
" 'width': ('width', 'width', 'Width', <string object: '0'>, 0)}"
]
},
"execution_count": 66,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"root = Tk()\n",
"root.title(\" Disease Prediction From Symptoms\")\n",
"root.configure()"
]
},
{
"cell_type": "code",
"execution_count": 67,
"id": "c8159b13",
"metadata": {},
"outputs": [],
"source": [
"Symptom1 = StringVar()\n",
"Symptom1.set(None)\n",
"Symptom2 = StringVar()\n",
"Symptom2.set(None)\n",
"Symptom3 = StringVar()\n",
"Symptom3.set(None)\n",
"Symptom4 = StringVar()\n",
"Symptom4.set(None)\n",
"Symptom5 = StringVar()\n",
"Symptom5.set(None)"
]
},
{
"cell_type": "code",
"execution_count": 68,
"id": "364b0dc0",
"metadata": {},
"outputs": [],
"source": [
"w2 = Label(root, justify=LEFT, text=\" Disease Prediction From Symptoms \")\n",
"w2.config(font=(\"Elephant\", 30))\n",
"w2.grid(row=1, column=0, columnspan=2, padx=100)"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "45d3004b",
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'Label' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m~\\AppData\\Local\\Temp/ipykernel_5980/1174286540.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mNameLb1\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mLabel\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mroot\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mtext\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m\"\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 2\u001b[0m \u001b[0mNameLb1\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mconfig\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfont\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"Elephant\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m20\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 3\u001b[0m \u001b[0mNameLb1\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mgrid\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mrow\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m5\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcolumn\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mpady\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m10\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0msticky\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mW\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[0mS1Lb\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mLabel\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mroot\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mtext\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m\"Symptom 1\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;31mNameError\u001b[0m: name 'Label' is not defined"
]
}
],
"source": [
"NameLb1 = Label(root, text=\"\")\n",
"NameLb1.config(font=(\"Elephant\", 20))\n",
"NameLb1.grid(row=5, column=1, pady=10, sticky=W)\n",
"\n",
"S1Lb = Label(root, text=\"Symptom 1\")\n",
"S1Lb.config(font=(\"Elephant\", 15))\n",
"S1Lb.grid(row=7, column=1, pady=10 , sticky=W)\n",
"\n",
"S2Lb = Label(root, text=\"Symptom 2\")\n",
"S2Lb.config(font=(\"Elephant\", 15))\n",
"S2Lb.grid(row=8, column=1, pady=10, sticky=W)\n",
"\n",
"S3Lb = Label(root, text=\"Symptom 3\")\n",
"S3Lb.config(font=(\"Elephant\", 15))\n",
"S3Lb.grid(row=9, column=1, pady=10, sticky=W)\n",
"\n",
"S4Lb = Label(root, text=\"Symptom 4\")\n",
"S4Lb.config(font=(\"Elephant\", 15))\n",
"S4Lb.grid(row=10, column=1, pady=10, sticky=W)\n",
"\n",
"S5Lb = Label(root, text=\"Symptom 5\")\n",
"S5Lb.config(font=(\"Elephant\", 15))\n",
"S5Lb.grid(row=11, column=1, pady=10, sticky=W)\n",
"\n",
"lr = Button(root, text=\"Predict\",height=2, width=20, command=message)\n",
"lr.config(font=(\"Elephant\", 15))\n",
"lr.grid(row=15, column=1,pady=20)\n",
"\n",
"OPTIONS = sorted(l1)\n",
"\n",
"S1En = OptionMenu(root, Symptom1,*OPTIONS)\n",
"S1En.grid(row=7, column=2)\n",
"\n",
"S2En = OptionMenu(root, Symptom2,*OPTIONS)\n",
"S2En.grid(row=8, column=2)\n",
"\n",
"S3En = OptionMenu(root, Symptom3,*OPTIONS)\n",
"S3En.grid(row=9, column=2)\n",
"\n",
"S4En = OptionMenu(root, Symptom4,*OPTIONS)\n",
"S4En.grid(row=10, column=2)\n",
"\n",
"S5En = OptionMenu(root, Symptom5,*OPTIONS)\n",
"S5En.grid(row=11, column=2)\n",
"\n",
"NameLb = Label(root, text=\"\")\n",
"NameLb.config(font=(\"Elephant\", 20))\n",
"NameLb.grid(row=13, column=1, pady=10, sticky=W)\n",
"\n",
"NameLb = Label(root, text=\"\")\n",
"NameLb.config(font=(\"Elephant\", 15))\n",
"NameLb.grid(row=18, column=1, pady=10, sticky=W)\n",
"\n",
"t3 = Text(root, height=2, width=30)\n",
"t3.config(font=(\"Elephant\", 20))\n",
"t3.grid(row=20, column=1 , padx=10)\n",
"\n",
"root.mainloop()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c709f002",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment