scatter_std
¶
scatter_std(
values: array,
index: array,
out_size: int,
semi_grad: bool = False,
eps: float = 1e-05,
) -> array
Computes the (population) standard deviation of the values grouped by index (along axis 0).
As in PyG's StdAggregation, the variance is clamped to eps before
the square root (so that the gradient stays finite) and standard
deviations up to sqrt(eps) are set to 0.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
array
|
Input array of shape |
required |
index
|
array
|
Array of shape |
required |
out_size
|
int
|
Number of groups. |
required |
semi_grad
|
bool
|
See |
False
|
eps
|
float
|
Lower bound of the variance. Default: |
1e-05
|
Returns:
| Type | Description |
|---|---|
array
|
An array of shape |
array
|
each group. |
Source code in mlx_graphs/utils/scatter.py
from mlx_graphs.utils.scatter import scatter_std · mlx_graphs/utils/scatter.py