nimare.meta.cbmr.CBMREstimator
- class CBMREstimator(group_categories=None, moderators=None, mask=None, spline_spacing=10, model=<class 'nimare.meta.models.PoissonEstimator'>, penalty=False, n_iter=2000, lr=1, lr_decay=0.999, tol=1e-09, device='cpu', random_state=None, **kwargs)[source]
Bases:
EstimatorCoordinate-based meta-regression with a spatial model.
Warning
Support for
Datasetinputs is deprecated and will be removed in a future release. PreferStudyset.Added in version 0.1.0.
- Parameters:
group_categories (
stror obj:list or obj:None, optional) – CBMR allows a collection to be categorized into multiple groups according to one or more group categories. Default is one-group CBMR.moderators (
stror obj:list or obj:None, optional) – CBMR can accommodate experiment-level moderators (e.g. sample size, year of publication). Default is CBMR without experiment-level moderators.model (subclass of
GeneralLinearModelEstimator, optional) –Stochastic model class used by CBMR. Available options are:
PoissonEstimator(default): the most efficient and widely used option, but slightly less accurate because it approximates low-rate binomial data, cannot account for over-dispersion in foci counts, and may underestimate standard errors.NegativeBinomialEstimator: slower and sometimes less stable, but slightly more accurate. This model allows anticipated excess variance relative to Poisson via a group-wise overdispersion parameter shared by all experiments and voxels.ClusteredNegativeBinomialEstimator: a random-effects Poisson variant that models experiment-level latent characteristics shared across the brain for a given experiment.
penalty (
bool, optional) – Currently, the only available option is Firth-type penalty, which penalizes the likelihood function by Jeffreys’ invariant prior and encourages convergence.spline_spacing (
int, optional) – Spatial structure of foci counts is parameterized by the coefficients of cubic B-spline bases in CBMR. Spatial smoothness in CBMR is determined by spline spacing, which is shared across the x, y, and z dimensions. Default is 10.n_iter (
int, optional) – Number of iterations allowed in the log-likelihood optimization. Default is 2000.lr (
float, optional) – Learning rate in optimization of log-likelihood function. Default is 1.lr_decay (
float, optional) – Multiplicative factor of learning rate decay. Default is 0.999.tol (
float, optional) – Stopping criterion based on the change in log-likelihood between two consecutive iterations. Default is 1e-9.device (
string, optional) – Device type (‘cpu’ or ‘cuda’) representing where operations will be allocated. Default is ‘cpu’.random_state (
int, optional) – Random seed used for torch-based weight initialization. Default is None.**kwargs – Keyword arguments. Arguments for the Estimator can be assigned here, Another optional argument is
mask.
- Variables:
masker (
NiftiMaskeror similar) – Masker object.inputs (
dict) – Inputs to the Estimator. For CBMR estimators, this includes the following keys: coordinates, mask_img (brain mask image), id (experiment ids), ids_by_group (experiment ids categorized by groups), moderators_by_group (experiment-level moderators categorized by groups, if present), coef_spline_bases (spatial matrix of cubic B-spline coefficients in x, y, and z), foci_per_voxel (voxelwise sum of foci counts across experiments, categorized by groups), foci_per_experiment (experiment-wise sum of foci counts across space, categorized by groups).
Notes
Follow-up inference is exposed through
CBMRResultandCBMRInference.Methods
fit(dataset[, drop_invalid])Fit Estimator to a collection.
get_params([deep])Get parameters for this estimator.
load(filename[, compressed])Load a pickled class instance from file.
save(filename[, compress])Pickle the class instance to the provided file.
set_params(**params)Set the parameters of this estimator.
- fit(dataset, drop_invalid=True)[source]
Fit Estimator to a collection.
- Parameters:
- Returns:
Result of Estimator fitting. Subclasses may return a
MetaResultsubclass.- Return type:
- Variables:
inputs (
dict) – Inputs used in _fit.warning:: (..) – Support for
Datasetinputs is deprecated and will be removed in a future release. PreferStudyset.and (The fit method is a light wrapper that runs input validation)
individual (preprocessing before fitting the actual model. Estimators')
should ("fitting" methods are implemented as _fit, although users)
fit. (call)
- classmethod load(filename, compressed=True)[source]
Load a pickled class instance from file.
- Parameters:
- Returns:
obj – Loaded class object.
- Return type:
class object
- set_params(**params)[source]
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form
<component>__<parameter>so that it’s possible to update each component of a nested object.- Return type:
self