From 2e9bde46883837e2601e1e4bb5be2dc1991d1508 Mon Sep 17 00:00:00 2001 From: Milan anand raj <84122339+manandraj20@users.noreply.github.com> Date: Fri, 1 Nov 2024 19:31:43 +0530 Subject: [PATCH] adding plot --- docs/requirements.txt | Bin 3812 -> 3850 bytes src/DP_epidemiology/contact_matrix.py | 12 ++++++++++++ 2 files changed, 12 insertions(+) diff --git a/docs/requirements.txt b/docs/requirements.txt index 8a8075b9e5c8c3a4465973c38e84969bce0d41ee..e19e0100427ac61b44c60c27d6c56248177ae934 100644 GIT binary patch delta 26 gcmaDN+abP}vrXgx09y?O@&Et; delta 12 TcmeB@dm_6bhi&sDwh9gaAtVHs diff --git a/src/DP_epidemiology/contact_matrix.py b/src/DP_epidemiology/contact_matrix.py index baebba4..2e7a76f 100644 --- a/src/DP_epidemiology/contact_matrix.py +++ b/src/DP_epidemiology/contact_matrix.py @@ -5,6 +5,7 @@ import os from datetime import datetime import opendp.prelude as dp +import matplotlib.pyplot as plt dp.enable_features("contrib", "floating-point", "honest-but-curious") @@ -119,3 +120,14 @@ def get_pearson_similarity(contact_matrix, Ground_truth_contact_matrix): Ground_truth_contact_matrix).flatten(), np.array(contact_matrix).flatten())[0, 1] return pearson_similarity +def plot_difference(A, B): + difference = A - B + + plt.figure(figsize=(10, 8)) + plt.imshow(difference, cmap='coolwarm', interpolation='none') + plt.colorbar(label='Difference') + plt.title('Difference between estimated_C and contact_others') + plt.xlabel('Index i2') + plt.ylabel('Index i1') + plt.show() +