Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
N
NLP-Project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
almohanad.hafez
NLP-Project
Commits
de72d7c1
Commit
de72d7c1
authored
Oct 17, 2024
by
Almouhannad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use constants class
parent
6097a6b2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
44 deletions
+47
-44
.gitignore
.gitignore
+1
-0
1.1-Preprocessing.ipynb
1.1-Preprocessing.ipynb
+20
-22
1.2-Morphological-Analyzer-Classifier.ipynb
1.2-Morphological-Analyzer-Classifier.ipynb
+22
-22
constants.py
constants.py
+4
-0
No files found.
.gitignore
View file @
de72d7c1
test.ipynb
clf-test.ipynb
__pycache__/constants.cpython-311.pyc
1.1-Preprocessing.ipynb
View file @
de72d7c1
...
...
@@ -9,7 +9,7 @@
},
{
"cell_type": "code",
"execution_count": 1
3
,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -18,18 +18,16 @@
"from sklearn.model_selection import train_test_split\n",
"\n",
"\n",
"DATASET_PATH = 'data/Symptom2Disease.csv'\n",
"TRAIN_SET_PATH = 'data/Preprocessed_Symptom2Disease_Train.csv'\n",
"TEST_SET_PATH = 'data/Preprocessed_Symptom2Disease_Test.csv'"
"from constants import CONSTANTS"
]
},
{
"cell_type": "code",
"execution_count":
14
,
"execution_count":
2
,
"metadata": {},
"outputs": [],
"source": [
"df = pd.read_csv(DATASET_PATH)"
"df = pd.read_csv(
CONSTANTS.
DATASET_PATH)"
]
},
{
...
...
@@ -41,7 +39,7 @@
},
{
"cell_type": "code",
"execution_count":
15
,
"execution_count":
3
,
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -50,7 +48,7 @@
},
{
"cell_type": "code",
"execution_count":
16
,
"execution_count":
4
,
"metadata": {},
"outputs": [
{
...
...
@@ -123,7 +121,7 @@
"4 4 Psoriasis My nails have small dents or pits in them, and..."
]
},
"execution_count":
16
,
"execution_count":
4
,
"metadata": {},
"output_type": "execute_result"
}
...
...
@@ -141,7 +139,7 @@
},
{
"cell_type": "code",
"execution_count":
17
,
"execution_count":
5
,
"metadata": {},
"outputs": [
{
...
...
@@ -208,7 +206,7 @@
"4 My nails have small dents or pits in them, and... Psoriasis"
]
},
"execution_count":
17
,
"execution_count":
5
,
"metadata": {},
"output_type": "execute_result"
}
...
...
@@ -229,7 +227,7 @@
},
{
"cell_type": "code",
"execution_count":
18
,
"execution_count":
6
,
"metadata": {},
"outputs": [
{
...
...
@@ -259,7 +257,7 @@
},
{
"cell_type": "code",
"execution_count":
19
,
"execution_count":
7
,
"metadata": {},
"outputs": [
{
...
...
@@ -293,7 +291,7 @@
},
{
"cell_type": "code",
"execution_count":
20
,
"execution_count":
8
,
"metadata": {},
"outputs": [
{
...
...
@@ -360,7 +358,7 @@
"4 I've been quite exhausted and ill. My throat h... Common Cold"
]
},
"execution_count":
20
,
"execution_count":
8
,
"metadata": {},
"output_type": "execute_result"
}
...
...
@@ -380,7 +378,7 @@
},
{
"cell_type": "code",
"execution_count":
21
,
"execution_count":
9
,
"metadata": {},
"outputs": [
{
...
...
@@ -441,7 +439,7 @@
},
{
"cell_type": "code",
"execution_count":
22
,
"execution_count":
10
,
"metadata": {},
"outputs": [
{
...
...
@@ -508,7 +506,7 @@
"4 i've been quite exhausted and ill. my throat h... common cold"
]
},
"execution_count":
22
,
"execution_count":
10
,
"metadata": {},
"output_type": "execute_result"
}
...
...
@@ -528,7 +526,7 @@
},
{
"cell_type": "code",
"execution_count":
23
,
"execution_count":
11
,
"metadata": {},
"outputs": [
{
...
...
@@ -548,12 +546,12 @@
},
{
"cell_type": "code",
"execution_count":
24
,
"execution_count":
12
,
"metadata": {},
"outputs": [],
"source": [
"train_df.to_csv(TRAIN_SET_PATH, index=False)\n",
"test_df.to_csv(TEST_SET_PATH, index=False)"
"train_df.to_csv(
CONSTANTS.
TRAIN_SET_PATH, index=False)\n",
"test_df.to_csv(
CONSTANTS.
TEST_SET_PATH, index=False)"
]
}
],
...
...
1.2-Morphological-Analyzer-Classifier.ipynb
View file @
de72d7c1
...
...
@@ -9,7 +9,7 @@
},
{
"cell_type": "code",
"execution_count": 1
5
,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -25,8 +25,8 @@
"from tabulate import tabulate\n",
"\n",
"import pandas as pd\n",
"
TRAIN_SET_PATH = 'data/Preprocessed_Symptom2Disease_Train.csv'
\n",
"
TEST_SET_PATH = 'data/Preprocessed_Symptom2Disease_Test.csv'
"
"\n",
"
from constants import CONSTANTS
"
]
},
{
...
...
@@ -38,7 +38,7 @@
},
{
"cell_type": "code",
"execution_count":
16
,
"execution_count":
2
,
"metadata": {},
"outputs": [
{
...
...
@@ -56,7 +56,7 @@
"True"
]
},
"execution_count":
16
,
"execution_count":
2
,
"metadata": {},
"output_type": "execute_result"
}
...
...
@@ -77,7 +77,7 @@
},
{
"cell_type": "code",
"execution_count":
17
,
"execution_count":
3
,
"metadata": {},
"outputs": [
{
...
...
@@ -95,7 +95,7 @@
"True"
]
},
"execution_count":
17
,
"execution_count":
3
,
"metadata": {},
"output_type": "execute_result"
}
...
...
@@ -113,7 +113,7 @@
},
{
"cell_type": "code",
"execution_count":
18
,
"execution_count":
4
,
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -127,7 +127,7 @@
},
{
"cell_type": "code",
"execution_count":
19
,
"execution_count":
5
,
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -141,7 +141,7 @@
},
{
"cell_type": "code",
"execution_count":
20
,
"execution_count":
6
,
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -169,22 +169,22 @@
},
{
"cell_type": "code",
"execution_count":
21
,
"execution_count":
7
,
"metadata": {},
"outputs": [],
"source": [
"train_set = pd.read_csv(TRAIN_SET_PATH)\n",
"train_set = pd.read_csv(
CONSTANTS.
TRAIN_SET_PATH)\n",
"X_train = train_set['text']\n",
"y_train = train_set['label']"
]
},
{
"cell_type": "code",
"execution_count":
22
,
"execution_count":
8
,
"metadata": {},
"outputs": [],
"source": [
"test_set = pd.read_csv(TEST_SET_PATH)\n",
"test_set = pd.read_csv(
CONSTANTS.
TEST_SET_PATH)\n",
"X_test = test_set['text']\n",
"y_test = test_set['label']"
]
...
...
@@ -198,7 +198,7 @@
},
{
"cell_type": "code",
"execution_count":
23
,
"execution_count":
9
,
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -215,7 +215,7 @@
},
{
"cell_type": "code",
"execution_count":
24
,
"execution_count":
10
,
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -240,7 +240,7 @@
},
{
"cell_type": "code",
"execution_count":
25
,
"execution_count":
11
,
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -261,19 +261,19 @@
},
{
"cell_type": "code",
"execution_count":
26
,
"execution_count":
12
,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<style>#sk-container-id-
2 {color: black;background-color: white;}#sk-container-id-2 pre{padding: 0;}#sk-container-id-2 div.sk-toggleable {background-color: white;}#sk-container-id-2 label.sk-toggleable__label {cursor: pointer;display: block;width: 100%;margin-bottom: 0;padding: 0.3em;box-sizing: border-box;text-align: center;}#sk-container-id-2 label.sk-toggleable__label-arrow:before {content: \"▸\";float: left;margin-right: 0.25em;color: #696969;}#sk-container-id-2 label.sk-toggleable__label-arrow:hover:before {color: black;}#sk-container-id-2 div.sk-estimator:hover label.sk-toggleable__label-arrow:before {color: black;}#sk-container-id-2 div.sk-toggleable__content {max-height: 0;max-width: 0;overflow: hidden;text-align: left;background-color: #f0f8ff;}#sk-container-id-2 div.sk-toggleable__content pre {margin: 0.2em;color: black;border-radius: 0.25em;background-color: #f0f8ff;}#sk-container-id-2 input.sk-toggleable__control:checked~div.sk-toggleable__content {max-height: 200px;max-width: 100%;overflow: auto;}#sk-container-id-2 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {content: \"▾\";}#sk-container-id-2 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-2 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-2 input.sk-hidden--visually {border: 0;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);height: 1px;margin: -1px;overflow: hidden;padding: 0;position: absolute;width: 1px;}#sk-container-id-2 div.sk-estimator {font-family: monospace;background-color: #f0f8ff;border: 1px dotted black;border-radius: 0.25em;box-sizing: border-box;margin-bottom: 0.5em;}#sk-container-id-2 div.sk-estimator:hover {background-color: #d4ebff;}#sk-container-id-2 div.sk-parallel-item::after {content: \"\";width: 100%;border-bottom: 1px solid gray;flex-grow: 1;}#sk-container-id-2 div.sk-label:hover label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-2 div.sk-serial::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: 0;}#sk-container-id-2 div.sk-serial {display: flex;flex-direction: column;align-items: center;background-color: white;padding-right: 0.2em;padding-left: 0.2em;position: relative;}#sk-container-id-2 div.sk-item {position: relative;z-index: 1;}#sk-container-id-2 div.sk-parallel {display: flex;align-items: stretch;justify-content: center;background-color: white;position: relative;}#sk-container-id-2 div.sk-item::before, #sk-container-id-2 div.sk-parallel-item::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: -1;}#sk-container-id-2 div.sk-parallel-item {display: flex;flex-direction: column;z-index: 1;position: relative;background-color: white;}#sk-container-id-2 div.sk-parallel-item:first-child::after {align-self: flex-end;width: 50%;}#sk-container-id-2 div.sk-parallel-item:last-child::after {align-self: flex-start;width: 50%;}#sk-container-id-2 div.sk-parallel-item:only-child::after {width: 0;}#sk-container-id-2 div.sk-dashed-wrapped {border: 1px dashed gray;margin: 0 0.4em 0.5em 0.4em;box-sizing: border-box;padding-bottom: 0.4em;background-color: white;}#sk-container-id-2 div.sk-label label {font-family: monospace;font-weight: bold;display: inline-block;line-height: 1.2em;}#sk-container-id-2 div.sk-label-container {text-align: center;}#sk-container-id-2 div.sk-container {/* jupyter's `normalize.less` sets `[hidden] { display: none; }` but bootstrap.min.css set `[hidden] { display: none !important; }` so we also need the `!important` here to be able to override the default hidden behavior on the sphinx rendered scikit-learn.org. See: https://github.com/scikit-learn/scikit-learn/issues/21755 */display: inline-block !important;position: relative;}#sk-container-id-2 div.sk-text-repr-fallback {display: none;}</style><div id=\"sk-container-id-2\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>MultinomialNB()</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-2\" type=\"checkbox\" checked><label for=\"sk-estimator-id-2
\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">MultinomialNB</label><div class=\"sk-toggleable__content\"><pre>MultinomialNB()</pre></div></div></div></div></div>"
"<style>#sk-container-id-
1 {color: black;background-color: white;}#sk-container-id-1 pre{padding: 0;}#sk-container-id-1 div.sk-toggleable {background-color: white;}#sk-container-id-1 label.sk-toggleable__label {cursor: pointer;display: block;width: 100%;margin-bottom: 0;padding: 0.3em;box-sizing: border-box;text-align: center;}#sk-container-id-1 label.sk-toggleable__label-arrow:before {content: \"▸\";float: left;margin-right: 0.25em;color: #696969;}#sk-container-id-1 label.sk-toggleable__label-arrow:hover:before {color: black;}#sk-container-id-1 div.sk-estimator:hover label.sk-toggleable__label-arrow:before {color: black;}#sk-container-id-1 div.sk-toggleable__content {max-height: 0;max-width: 0;overflow: hidden;text-align: left;background-color: #f0f8ff;}#sk-container-id-1 div.sk-toggleable__content pre {margin: 0.2em;color: black;border-radius: 0.25em;background-color: #f0f8ff;}#sk-container-id-1 input.sk-toggleable__control:checked~div.sk-toggleable__content {max-height: 200px;max-width: 100%;overflow: auto;}#sk-container-id-1 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {content: \"▾\";}#sk-container-id-1 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-1 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-1 input.sk-hidden--visually {border: 0;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);height: 1px;margin: -1px;overflow: hidden;padding: 0;position: absolute;width: 1px;}#sk-container-id-1 div.sk-estimator {font-family: monospace;background-color: #f0f8ff;border: 1px dotted black;border-radius: 0.25em;box-sizing: border-box;margin-bottom: 0.5em;}#sk-container-id-1 div.sk-estimator:hover {background-color: #d4ebff;}#sk-container-id-1 div.sk-parallel-item::after {content: \"\";width: 100%;border-bottom: 1px solid gray;flex-grow: 1;}#sk-container-id-1 div.sk-label:hover label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-1 div.sk-serial::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: 0;}#sk-container-id-1 div.sk-serial {display: flex;flex-direction: column;align-items: center;background-color: white;padding-right: 0.2em;padding-left: 0.2em;position: relative;}#sk-container-id-1 div.sk-item {position: relative;z-index: 1;}#sk-container-id-1 div.sk-parallel {display: flex;align-items: stretch;justify-content: center;background-color: white;position: relative;}#sk-container-id-1 div.sk-item::before, #sk-container-id-1 div.sk-parallel-item::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: -1;}#sk-container-id-1 div.sk-parallel-item {display: flex;flex-direction: column;z-index: 1;position: relative;background-color: white;}#sk-container-id-1 div.sk-parallel-item:first-child::after {align-self: flex-end;width: 50%;}#sk-container-id-1 div.sk-parallel-item:last-child::after {align-self: flex-start;width: 50%;}#sk-container-id-1 div.sk-parallel-item:only-child::after {width: 0;}#sk-container-id-1 div.sk-dashed-wrapped {border: 1px dashed gray;margin: 0 0.4em 0.5em 0.4em;box-sizing: border-box;padding-bottom: 0.4em;background-color: white;}#sk-container-id-1 div.sk-label label {font-family: monospace;font-weight: bold;display: inline-block;line-height: 1.2em;}#sk-container-id-1 div.sk-label-container {text-align: center;}#sk-container-id-1 div.sk-container {/* jupyter's `normalize.less` sets `[hidden] { display: none; }` but bootstrap.min.css set `[hidden] { display: none !important; }` so we also need the `!important` here to be able to override the default hidden behavior on the sphinx rendered scikit-learn.org. See: https://github.com/scikit-learn/scikit-learn/issues/21755 */display: inline-block !important;position: relative;}#sk-container-id-1 div.sk-text-repr-fallback {display: none;}</style><div id=\"sk-container-id-1\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>MultinomialNB()</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-1\" type=\"checkbox\" checked><label for=\"sk-estimator-id-1
\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">MultinomialNB</label><div class=\"sk-toggleable__content\"><pre>MultinomialNB()</pre></div></div></div></div></div>"
],
"text/plain": [
"MultinomialNB()"
]
},
"execution_count":
26
,
"execution_count":
12
,
"metadata": {},
"output_type": "execute_result"
}
...
...
@@ -292,7 +292,7 @@
},
{
"cell_type": "code",
"execution_count":
27
,
"execution_count":
13
,
"metadata": {},
"outputs": [
{
...
...
@@ -318,7 +318,7 @@
},
{
"cell_type": "code",
"execution_count":
28
,
"execution_count":
14
,
"metadata": {},
"outputs": [
{
...
...
constants.py
0 → 100644
View file @
de72d7c1
class
CONSTANTS
:
DATASET_PATH
=
'data/Symptom2Disease.csv'
TRAIN_SET_PATH
=
'data/Preprocessed_Symptom2Disease_Train.csv'
TEST_SET_PATH
=
'data/Preprocessed_Symptom2Disease_Test.csv'
\ No newline at end of file
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