Skip to content

Commit

Permalink
fixed bugs after pandas and networkx updates
Browse files Browse the repository at this point in the history
  • Loading branch information
peach-lucien committed Jan 27, 2024
1 parent c55515f commit eefe31a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions hcga/feature_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,13 @@ def _clustering_statistics(self, community_partition, feat_name, feat_desc, feat

self.add_feature(
feat_name + "_coverage",
partial(quality.coverage, partition=community_partition),
lambda: list(partial(quality.partition_quality, partition=community_partition))[0],
"Coverage" + compl_desc,
feat_interpret,
)
self.add_feature(
feat_name + "_performance",
partial(quality.performance, partition=community_partition),
lambda: list(partial(quality.partition_quality, partition=community_partition))[1],
"Performance" + compl_desc,
feat_interpret,
)
Expand Down
7 changes: 5 additions & 2 deletions hcga/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import pandas as pd
import seaborn as sns
import shap
from matplotlib.backends.backend_pdf import PdfPages
Expand Down Expand Up @@ -183,7 +184,8 @@ def _plot_dendrogram_shap(
top_feat_idx = shap_feature_importance.argsort()[-max_feats:]
X_red = X[X.columns[top_feat_idx]]
# to make sure to have the reduced features
X_red = X_red.T.append(X[reduced_features].T).drop_duplicates().T
#X_red = X_red.T.append(X[reduced_features].T).drop_duplicates().T
X_red = pd.concat([X_red.T, X[reduced_features].T]).drop_duplicates().T

plt.figure(figsize=(20, 1.2 * 20))
gs = GridSpec(2, 1, height_ratios=[0.2, 1.0])
Expand Down Expand Up @@ -223,7 +225,8 @@ def _plot_feature_correlation(
top_feat_idx = shap_feature_importance.argsort()[-max_feats:]
X_red = X[X.columns[top_feat_idx]].sort_index(axis=0).sort_index(axis=1)
# to make sure to have the reduced features
X_red = X_red.T.append(X[reduced_features].T).drop_duplicates().T
#X_red = X_red.T.append(X[reduced_features].T).drop_duplicates().T
X_red = pd.concat([X_red.T, X[reduced_features].T]).drop_duplicates().T

cor_sorted = np.abs(X_red.corr())

Expand Down

0 comments on commit eefe31a

Please sign in to comment.