Skip to content

Commit

Permalink
user guide: missingness
Browse files Browse the repository at this point in the history
  • Loading branch information
aditya0by0 committed Jul 23, 2024
1 parent 2861eb4 commit ba89df5
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 31 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
# Simply exclude this file from counting now:

notebooks/*.ipynb linguist-generated=true
stream_viz/tutorial/*.ipynb linguist-generated=true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,5 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

/notebooks
8 changes: 6 additions & 2 deletions stream_viz/data_missingness/missingness.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def __init__(self, **kwargs):
self._bin_n_col_regex: str = kwargs.get("bin_n_col_regex", r"bin_idx*n*")
self._na_col_regex: str = kwargs.get("na_col_regex", r"is_na_*\d*")
self._na_col_name: str = kwargs.get("na_col_name", "is_na_")
# self._X_data = X_data

def compute_mar_matrix(self, X_df_encoded_m_ind: pd.DataFrame) -> pd.DataFrame:
"""
Expand Down Expand Up @@ -94,12 +95,13 @@ def plot_graph(
X_data = X_df_encoded_m_ind.iloc[start_tpt:end_tpt]
X_data = self._add_missing_indicator_cols(X_data)
p_value_matrix = self.compute_mar_matrix(X_data)
self._X_data = X_data

# Create a heatmap with highlighting
plt.figure(figsize=(12, 8))
heatmap = sns.heatmap(
p_value_matrix,
annot=True,
# annot=True,
cmap="coolwarm",
cbar_kws={"label": "p-value"},
linewidths=0.5,
Expand Down Expand Up @@ -133,7 +135,9 @@ def plot_graph(
fontsize=10,
)

plt.title(f"Chi-Square Test p-values")
plt.title(
f"Chi-Square Test p-values for data from {start_tpt} to {end_tpt} timepoint"
)
plt.show()

def _add_missing_indicator_cols(self, X_df_encoded_m):
Expand Down
119 changes: 90 additions & 29 deletions stream_viz/tutorial/UserGuide.ipynb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ba89df5

Please sign in to comment.