diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 22df950..94a8a3d 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -19,7 +19,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
- python-version: '3.x'
+ python-version: '3.11'
- name: Install dependencies
run: |
diff --git a/demo_final_contact_matrix.ipynb b/demo_final_contact_matrix.ipynb
index f15f795..01e71b4 100644
--- a/demo_final_contact_matrix.ipynb
+++ b/demo_final_contact_matrix.ipynb
@@ -24,7 +24,7 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": 5,
"metadata": {},
"outputs": [
{
@@ -49,10 +49,10 @@
"
\n",
" | \n",
" ID | \n",
+ " date | \n",
" merch_category | \n",
" merch_postal_code | \n",
" transaction_type | \n",
- " date | \n",
" spendamt | \n",
" nb_transactions | \n",
"
\n",
@@ -61,80 +61,80 @@
" \n",
" 0 | \n",
" 1 | \n",
- " Hospitals | \n",
- " 111921 | \n",
- " ONLINE | \n",
" 2019-01-01 | \n",
- " 80797.323317 | \n",
- " 398 | \n",
+ " Grocery Stores/Supermarkets | \n",
+ " 8700000 | \n",
+ " ONLINE | \n",
+ " 11238.128450 | \n",
+ " 160 | \n",
"
\n",
" \n",
" 1 | \n",
- " 2 | \n",
- " Bars/Discotheques | \n",
- " 050025 | \n",
- " OFFLINE | \n",
+ " 1 | \n",
" 2019-01-01 | \n",
- " 5331.031100 | \n",
- " 283 | \n",
+ " Grocery Stores/Supermarkets | \n",
+ " 500034 | \n",
+ " ONLINE | \n",
+ " 12848.165221 | \n",
+ " 183 | \n",
"
\n",
" \n",
" 2 | \n",
" 2 | \n",
- " Bars/Discotheques | \n",
- " 050032 | \n",
- " OFFLINE | \n",
" 2019-01-01 | \n",
- " 5180.722635 | \n",
- " 268 | \n",
+ " Grocery Stores/Supermarkets | \n",
+ " 110621 | \n",
+ " ONLINE | \n",
+ " 12116.165569 | \n",
+ " 173 | \n",
"
\n",
" \n",
" 3 | \n",
" 3 | \n",
- " Drug Stores/Pharmacies | \n",
- " 050012 | \n",
- " OFFLINE | \n",
" 2019-01-01 | \n",
- " 5032.333763 | \n",
- " 177 | \n",
+ " Hotels/Motels | \n",
+ " 8900000 | \n",
+ " OFFLINE | \n",
+ " 7745.998879 | \n",
+ " 38 | \n",
"
\n",
" \n",
" 4 | \n",
- " 3 | \n",
- " Drug Stores/Pharmacies | \n",
- " 050031 | \n",
- " OFFLINE | \n",
+ " 4 | \n",
" 2019-01-01 | \n",
- " 4899.182326 | \n",
- " 150 | \n",
+ " Restaurants | \n",
+ " 111941 | \n",
+ " OFFLINE | \n",
+ " 6927.424754 | \n",
+ " 173 | \n",
"
\n",
" \n",
"\n",
""
],
"text/plain": [
- " ID merch_category merch_postal_code transaction_type date \\\n",
- "0 1 Hospitals 111921 ONLINE 2019-01-01 \n",
- "1 2 Bars/Discotheques 050025 OFFLINE 2019-01-01 \n",
- "2 2 Bars/Discotheques 050032 OFFLINE 2019-01-01 \n",
- "3 3 Drug Stores/Pharmacies 050012 OFFLINE 2019-01-01 \n",
- "4 3 Drug Stores/Pharmacies 050031 OFFLINE 2019-01-01 \n",
+ " ID date merch_category merch_postal_code \\\n",
+ "0 1 2019-01-01 Grocery Stores/Supermarkets 8700000 \n",
+ "1 1 2019-01-01 Grocery Stores/Supermarkets 500034 \n",
+ "2 2 2019-01-01 Grocery Stores/Supermarkets 110621 \n",
+ "3 3 2019-01-01 Hotels/Motels 8900000 \n",
+ "4 4 2019-01-01 Restaurants 111941 \n",
"\n",
- " spendamt nb_transactions \n",
- "0 80797.323317 398 \n",
- "1 5331.031100 283 \n",
- "2 5180.722635 268 \n",
- "3 5032.333763 177 \n",
- "4 4899.182326 150 "
+ " transaction_type spendamt nb_transactions \n",
+ "0 ONLINE 11238.128450 160 \n",
+ "1 ONLINE 12848.165221 183 \n",
+ "2 ONLINE 12116.165569 173 \n",
+ "3 OFFLINE 7745.998879 38 \n",
+ "4 OFFLINE 6927.424754 173 "
]
},
- "execution_count": 3,
+ "execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "data = pd.read_csv(r\"C:\\Users\\Milan Anand Raj\\Desktop\\KNOWLEDGEEDGEAI\\PET\\final_data\\final_technical_data.csv\")\n",
+ "data = pd.read_csv(r'D:\\workspace\\PET\\technical_phase_data.csv')\n",
"data.head()"
]
},
@@ -147,7 +147,7 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
@@ -167,7 +167,7 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
@@ -184,7 +184,7 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
@@ -193,7 +193,7 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
@@ -357,11 +357,26 @@
"source": [
"estimated_contact_matrix"
]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import matplotlib.pyplot as plt\n",
+ "\n",
+ "diff = estimated_C \n",
+ "\n",
+ "plt.figure(figsize=(10, 8))\n",
+ "plt.imshow(diff, cmap = 'coolwarm', interpolation='none')\n",
+ "plt.colorbar(label = 'Diff')"
+ ]
}
],
"metadata": {
"kernelspec": {
- "display_name": ".venv",
+ "display_name": "Python 3",
"language": "python",
"name": "python3"
},
@@ -375,7 +390,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.12.7"
+ "version": "3.12.4"
}
},
"nbformat": 4,
diff --git a/dist/dp_epidemiology-0.0.9.tar.gz b/dist/dp_epidemiology-0.0.9.tar.gz
deleted file mode 100644
index 03eb266..0000000
Binary files a/dist/dp_epidemiology-0.0.9.tar.gz and /dev/null differ
diff --git a/dist/dp_epidemiology-0.0.9-py3-none-any.whl b/dist/dp_epidemiology-0.1.0-py3-none-any.whl
similarity index 51%
rename from dist/dp_epidemiology-0.0.9-py3-none-any.whl
rename to dist/dp_epidemiology-0.1.0-py3-none-any.whl
index f58ac60..3e49bca 100644
Binary files a/dist/dp_epidemiology-0.0.9-py3-none-any.whl and b/dist/dp_epidemiology-0.1.0-py3-none-any.whl differ
diff --git a/dist/dp_epidemiology-0.1.0.tar.gz b/dist/dp_epidemiology-0.1.0.tar.gz
new file mode 100644
index 0000000..89e35e0
Binary files /dev/null and b/dist/dp_epidemiology-0.1.0.tar.gz differ
diff --git a/pyproject.toml b/pyproject.toml
index e100188..abbd468 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "DP_epidemiology"
-version = "0.0.9"
+version = "0.1.0"
dependencies = [
"pandas>=2.1.4",
diff --git a/src/DP_epidemiology/utilities.py b/src/DP_epidemiology/utilities.py
index e205560..6525db3 100644
--- a/src/DP_epidemiology/utilities.py
+++ b/src/DP_epidemiology/utilities.py
@@ -397,5 +397,6 @@ def time_preprocess(df):
# Filter the dataframe based on the category
df_final = df_weekly[["date", category]]
+ df_final[category] = (df_final[category] - df_final[category].min()) / (df_final[category].max() - df_final[category].min())
return df_final