diff --git a/superblockify/metrics/measures.py b/superblockify/metrics/measures.py index 2c75200..5c32d37 100644 --- a/superblockify/metrics/measures.py +++ b/superblockify/metrics/measures.py @@ -167,9 +167,9 @@ def calculate_coverage(partitioner, weight): if partitioner.graph.number_of_edges() == partitioner.sparsified.number_of_edges(): return 0 - return 1 - npsum( + return 1 - sum( d[weight] for u, v, d in partitioner.sparsified.edges(data=True) - ) / npsum(d[weight] for u, v, d in partitioner.graph.edges(data=True)) + ) / sum(d[weight] for u, v, d in partitioner.graph.edges(data=True)) def rel_increase(value_i, value_j): diff --git a/superblockify/partitioning/utils.py b/superblockify/partitioning/utils.py index 20f39d5..097288f 100644 --- a/superblockify/partitioning/utils.py +++ b/superblockify/partitioning/utils.py @@ -272,10 +272,12 @@ def show_highway_stats(graph): "Dtype counts (type, count, proportion): \n%s", dtype_counts.to_string() ) # Warning if 'str' is underrepresented - if dtype_counts.loc[dtype_counts.index == str, "proportion"].values < 0.98: + str_proportion_series = dtype_counts.loc[dtype_counts.index == str, "proportion"] + str_proportion = str_proportion_series.iloc[0] if not str_proportion_series.empty else 0.0 + if str_proportion < 0.98: logger.warning( "The dtype of the 'highway' attribute is not 'str' in %d%% of the edges.", - (1 - dtype_counts.loc[dtype_counts.index == str, "proportion"]) * 100, + int((1 - str_proportion) * 100), )