Stats
These are utility functions used to compute simple statistics across simplices and neighborhoods.
Functions to average (functional or structural) metrics across simplices or neighborhoods. Author(s): Daniela Egas Santander, Last update: 11.2023
edge_stats_participation(participation, vals, condition=operator.eq, dims=None)
Get statistics of the values in vals across edges filtered using edge participation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
participation |
DataFrame
|
DataFrame of edge participation with index the edges of an NxN matrix to consider, columns are dimensions and values are edge participation. |
required |
values |
Series
|
pandas Series with index the edges of the NxN matrix of which edge participation has been computed and vals the values on that edge to be averaged. |
required |
condition |
operator
|
operator with which to filter the nodes. The default |
eq
|
dims |
iterable
|
dimensions for which to run the analysis, if |
None
|
Returns:
Type | Description |
---|---|
DataFrame
|
with index, the dimensions for which the analysis have been run and columns the statistics of the values in vals where the nodes have been grouped according to the condition given. |
Source code in src/connalysis/network/stats.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
|
node_stats_neighborhood(values, adj=None, pre=True, post=True, all_nodes=True, centers=None, include_center=True, precomputed=False, neighborhoods=None)
Get basic statistics of the property values on the neighbhood of the nodes in centers in the graph described by adj.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
values |
Series
|
pandas Series with index the nodes of the NxN matrix of which the simplices are listed, and values the values on that node to be averaged. |
required |
adj |
sparse matrix or 2d array
|
The adjacency matrix of the graph |
None
|
pre |
bool
|
If |
True
|
post |
bool
|
If |
True
|
all_nodes |
bool
|
If |
True
|
centers |
1d-array
|
The indices of the nodes for which the neighbors need to be computed. This entry is ignored if
all_nodes is |
None
|
include_center |
bool
|
If |
True
|
precomputed |
bool
|
If |
False
|
neighborhoods |
DataFrame
|
DataFrame of neighbhoord indices. Required if precomputed is |
None
|
Returns:
Type | Description |
---|---|
DataFrame
|
with index, centers to be considered and columns the sum, mean, standard deviation and standard error of the mean of the values in that neighborhood. |
See Also
[neighborhood_indices] (network_local.md#src.connalysis.network.local.neighborhood_indices):
Function to precompute the neighborhood_indices that can be used if precomputed is set True
.
Precomputing the neighborhoods would increase efficiency if multiple properties are averaged across neighborhoods.
Source code in src/connalysis/network/stats.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
|
node_stats_participation(participation, vals, condition=operator.eq, dims=None)
Get statistics of the values in vals across nodes filtered using node participation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
participation |
DataFrame
|
DataFrame of node participation with index the nodes in nodes of an NxN matrix to consider, columns are dimensions and values are node participation computed with node_participation. |
required |
values |
Series
|
pandas Series with index the nodes of the NxN matrix of where node participation has been computed and vals the values on that node to be averaged. |
required |
condition |
operator
|
operator with which to filter the nodes. The default |
eq
|
dims |
iterable
|
dimensions for which to run the analysis, if |
None
|
Returns:
Type | Description |
---|---|
DataFrame
|
with index, the dimensions for which the analysis have been run and columns the statistics of the values in vals where the nodes have been grouped according to the condition given. |
See Also
node_stats_per_position_single:
A similar function where the position of the nodes in the simplex are taken into account. Note in particular that
if condition = operator.ge
the weighted_mean of this analyisis is equivalent than the value given by this function for position all
.
However the computation using
node_participation
is more efficient.
Source code in src/connalysis/network/stats.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
|
node_stats_per_position(simplex_lists, values, dims=None, with_multiplicity=True)
Get across dimensions mean, standard deviation and standard error of the mean averaged across simplex lists and filtered per position
Parameters:
Name | Type | Description | Default |
---|---|---|---|
simplex_lists |
dict
|
keys : are int values representing dimensions
values : for key |
required |
values |
Series
|
pandas Series with index the nodes of the NxN matrix of which the simplices are listed, and values the values on that node to be averaged. |
required |
with_multiplicity |
bool
|
if |
True
|
dims |
iterable
|
dimensions for which to run the analysis, if |
None
|
Returns:
Type | Description |
---|---|
dict
|
keys the dimensions anlayzed and values for key |
Source code in src/connalysis/network/stats.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
node_stats_per_position_single(simplex_list, values, with_multiplicity=True)
Get mean, standard deviation and standard error of the mean averaged across simplex lists and filtered per position
Parameters:
Name | Type | Description | Default |
---|---|---|---|
simplex_list |
2d-array
|
Array of dimension (no. of simplices, dimension) listing simplices to be considered. Each row corresponds to a list of nodes on a simplex indexed by the order of the nodes in an NxN matrix. All entries must be an index in values |
required |
values |
Series
|
pandas Series with index the nodes of the NxN matrix of which the simplices are listed, and values the values on that node to be averaged. |
required |
with_multiplicity |
bool
|
if |
True
|
Returns:
Type | Description |
---|---|
DataFrame
|
with index, the possible positions of o node in a |
Source code in src/connalysis/network/stats.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
|