brainspace.null_models.moran.MoranRandomization¶
-
class
brainspace.null_models.moran.
MoranRandomization
(procedure='singleton', spectrum='nonzero', joint=False, n_rep=100, n_ring=1, tol=1e-10, random_state=None)[source]¶ Moran spectral randomization.
Parameters: - procedure ({'singleton, 'pair'}, optional) – Procedure to generate the random samples. Default is ‘singleton’.
- spectrum ({'all', 'nonzero'}, optional) – Eigenvalues/vectors to select. If ‘all’, recover all eigenvectors except one. Otherwise, select all except non-zero eigenvectors. Default is ‘nonzero’.
- joint (boolean, optional) – If True variables are randomized jointly. Otherwise, each variable is randomized separately. Default is False.
- n_rep (int, optional) – Number of randomizations. Default is 100.
- n_ring (int, optional) – Neighborhood size to build the weight matrix. Only used if user provides a surface mesh. Default is 1.
- tol (float, optional) – Minimum value for an eigenvalue to be considered non-zero. Default is 1e-10.
- random_state (int or None, optional) – Random state. Default is None.
Variables: - mev (1D ndarray, shape (n_components,)) – Eigenvalues of the weight matrix in descending order.
- mem (2D ndarray, shape (n_vertices, n_components)) – Eigenvectors of the weight matrix in same order.
See also
-
__init__
(procedure='singleton', spectrum='nonzero', joint=False, n_rep=100, n_ring=1, tol=1e-10, random_state=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
([procedure, spectrum, joint, …])Initialize self. fit
(w)Compute Moran eigenvectors map. get_params
([deep])Get parameters for this estimator. randomize
(x)Generate random samples from x. set_params
(**params)Set the parameters of this estimator. -
fit
(w)[source]¶ Compute Moran eigenvectors map.
Parameters: w (BSPolyData, ndarray or sparse matrix, shape = (n_verts, n_verts)) – Spatial weight matrix or surface. If surface, the weight matrix is built based on the inverse geodesic distance between each vertex and the vertices in its n_ring. Returns: self (object) – Returns self.
-
randomize
(x)[source]¶ Generate random samples from x.
Parameters: x (1D or 2D ndarray, shape = (n_verts,) or (n_verts, n_feat)) – Array of variables arranged in columns, where n_feat is the number of variables. Returns: output (ndarray, shape = (n_rep, n_verts, n_feat)) – Random samples. If n_feat == 1
, shape = (n_rep, n_verts).