risk-network 0.0.9b31__tar.gz → 0.0.9b32__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {risk_network-0.0.9b31/risk_network.egg-info → risk_network-0.0.9b32}/PKG-INFO +1 -1
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/__init__.py +1 -1
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/stats/permutation/test_functions.py +9 -5
- {risk_network-0.0.9b31 → risk_network-0.0.9b32/risk_network.egg-info}/PKG-INFO +1 -1
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/LICENSE +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/MANIFEST.in +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/README.md +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/pyproject.toml +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/annotations/__init__.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/annotations/annotations.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/annotations/io.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/constants.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/log/__init__.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/log/console.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/log/parameters.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/neighborhoods/__init__.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/neighborhoods/api.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/neighborhoods/community.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/neighborhoods/domains.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/neighborhoods/neighborhoods.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/network/__init__.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/network/geometry.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/network/graph/__init__.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/network/graph/api.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/network/graph/graph.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/network/graph/summary.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/network/io.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/network/plotter/__init__.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/network/plotter/api.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/network/plotter/canvas.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/network/plotter/contour.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/network/plotter/labels.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/network/plotter/network.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/network/plotter/plotter.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/network/plotter/utils/colors.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/network/plotter/utils/layout.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/risk.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/stats/__init__.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/stats/permutation/__init__.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/stats/permutation/permutation.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/stats/significance.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk/stats/stat_tests.py +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk_network.egg-info/SOURCES.txt +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk_network.egg-info/dependency_links.txt +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk_network.egg-info/requires.txt +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/risk_network.egg-info/top_level.txt +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/setup.cfg +0 -0
- {risk_network-0.0.9b31 → risk_network-0.0.9b32}/setup.py +0 -0
@@ -46,19 +46,23 @@ def compute_neighborhood_score_by_stdev(
|
|
46
46
|
neighborhood_score = neighborhoods_matrix @ annotation_matrix # Sparse matrix multiplication
|
47
47
|
# Calculate the number of elements in each neighborhood (sum of rows)
|
48
48
|
N = neighborhoods_matrix.sum(axis=1).A.flatten() # Convert to 1D array
|
49
|
-
|
50
|
-
|
49
|
+
if np.any(N == 0):
|
50
|
+
# Replace zeros in N with small positive values to avoid division errors
|
51
|
+
N = np.where(N == 0, np.nan, N)
|
52
|
+
|
51
53
|
# Compute the mean of the neighborhood scores
|
52
54
|
M = neighborhood_score.multiply(1 / N[:, None]).toarray() # Sparse element-wise division
|
53
55
|
# Compute the mean of squares (EXX) directly using squared annotation matrix
|
54
56
|
annotation_squared = annotation_matrix.multiply(annotation_matrix) # Element-wise squaring
|
55
57
|
EXX = (neighborhoods_matrix @ annotation_squared).multiply(1 / N[:, None]).toarray()
|
56
|
-
|
57
|
-
variance
|
58
|
+
|
59
|
+
# Calculate variance as EXX - M^2, ensuring no negative variances
|
60
|
+
variance = np.maximum(EXX - np.power(M, 2), 0)
|
58
61
|
# Compute the standard deviation as the square root of the variance
|
59
62
|
neighborhood_stdev = np.sqrt(variance)
|
60
|
-
# Replace np.nan back with zeros
|
63
|
+
# Replace np.nan back with zeros for rows where N was 0
|
61
64
|
neighborhood_stdev[np.isnan(neighborhood_stdev)] = 0
|
65
|
+
|
62
66
|
return neighborhood_stdev
|
63
67
|
|
64
68
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|