brainmass.LaplacianConnParam#
- class brainmass.LaplacianConnParam(W, t=IdentityT(), reg=None, mask=None, fit=True, normalize=None, eps=1e-12, return_diag=False)#
Graph Laplacian connectivity module.
This module computes the graph Laplacian matrix from a given adjacency/connectivity matrix using one of three standard forms: unnormalized, random walk normalized, or symmetric normalized.
- Parameters:
W (
Array|ndarray|bool|number|bool|int|float|complex|Quantity) – Adjacency or connectivity matrix with shape(N, N)representing weighted edges between N nodes.normalize (
Literal['rw','sym'] |None) –Normalization mode for the Laplacian:
None(default): Returns unnormalized Laplacian L = W - D"rw": Returns random walk normalized Laplacian L_rw = D^{-1}W - I"sym": Returns symmetric normalized Laplacian L_sym = D^{-1/2}W D^{-1/2} - I
eps (
float) – Small constant added for numerical stability when computing D^{-1} or D^{-1/2}.t (
Transform) – Optional transform applied to W before computing the Laplacian. Default is IdentityT (no transform).return_diag (
bool) – If True, the module’s value will be a tuple (L, d) where L is the Laplacian matrix and d is the degree vector. If False (default), the module’s value will be just the Laplacian matrix L.
- Return type:
Any
- __init__(W, t=IdentityT(), reg=None, mask=None, fit=True, normalize=None, eps=1e-12, return_diag=False)[source]#
Methods
__init__(W[, t, reg, mask, fit, normalize, ...])cache()Manually cache the transformed value.
check_valid_context(error_msg)Check if the current context is valid for mutation.
children()Return immediate child modules.
clear_cache()Explicitly clear the parameter transformation cache.
clip([min_val, max_val])Clamp parameter value in-place.
desc(*args, **kwargs)Create a parameter describer for this class.
init(data[, sizes, allow_none])Initialize parameters.
init_all_states(*args[, state_tag])init_state(*args, **kwargs)State initialization function.
modules([include_self])Return all modules in the network.
named_children()Return an iterator over immediate child modules, yielding name and module.
named_modules([prefix, include_self])Return an iterator over all modules in the network, yielding name and module.
named_param_modules([allowed_hierarchy])Iterate over (name, parameter) pairs.
named_parameters([prefix, recurse])Return an iterator over module parameters, yielding name and parameter.
nodes(*filters[, allowed_hierarchy])Collect all children nodes.
normalize(weight)param_modules([allowed_hierarchy])Collect all Param parameters in this module and children.
param_precompute([allowed_hierarchy])Context manager to temporarily cache all Param parameters.
parameters([recurse])Return module parameters.
reg_loss()Calculate regularization loss.
reset_state(*args, **kwargs)State resetting function.
reset_to_prior()Reset parameter value to regularization prior value.
set_value(value)Set parameter value from constrained space.
state_trees(*filters)Collect all states in this node and the children nodes.
states(*filters[, allowed_hierarchy])Collect all states in this node and the children nodes.
update(**kwargs)value()Get current parameter value after applying transform.
Attributes
cache_statsGet cache statistics (for debugging/monitoring).
graph_invisible_attrsin_sizenameName of the model.
non_hashable_paramsout_size