Conversation
|
this also superseeds #103 |
| return 0 | ||
|
|
||
| return 1 - npsum( | ||
| return 1 - sum( |
There was a problem hiding this comment.
This now uses the python integrated sum? If we are not using numpy's sum, then the import from numpy import sum as npsum should be removed, as it is not used anywhere else in this file. I'm confused why this is erroring here, while using sum by numpy sin other places of this package still works.
I'd say if the CI works there is no need to dig into the details.
There was a problem hiding this comment.
Yes, I went for the simpler way as suggested in the error line I was getting. I did not remove the import as the npsum is still used in calculate_global_efficiency
def calculate_global_efficiency(distance_matrix, measure1, measure2):
r"""Calculate the global efficiency for the given network measures.
The global efficiency is the ratio between the sums of the inverses of the
distances of the two network measures.
If any of the distances is 0 or infinite, it is ignored in the calculation.
Parameters
----------
distance_matrix : dict
The distance matrix for the network measures, as returned by instance attribute
:attr:`superblockify.metrics.metric.Metric.distance_matrix`
measure1 : str
The first network measure
measure2 : str
The second network measure
Returns
-------
float
The global efficiency of the network measures
Notes
-----
.. math::
E_{\text{glob},S/E}=\frac{\sum_{i \neq j}\frac{1}{d_S(i, j)}}
{\sum_{i \neq j} \frac{1}{d_E(i, j)}}
"""
dist1, dist2 = _network_measures_filtered_flattened(
distance_matrix, measure1, measure2
)
# Calculate the global efficiency as the ratio between the sums of the inverses
return npsum(1 / dist1) / npsum(1 / dist2)There was a problem hiding this comment.
Good point, I did not see it there. Let's see what the second CI run now says.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #104 +/- ##
=======================================
Coverage 98.54% 98.55%
=======================================
Files 31 31
Lines 1861 1863 +2
Branches 333 333
=======================================
+ Hits 1834 1836 +2
Misses 4 4
Partials 23 23 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thank you for the PR and easy fix. The CI passes. |
This updates the code to fix #102
Closes #102.