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', **kwargs)[source]

Bases: Estimator

Coordinate-based meta-regression with a spatial model.

New in version 0.1.0.

Parameters:
  • group_categories (str or obj:list or obj:None, optional) – CBMR allows dataset to be categorized into mutiple groups, according to group categories. Default is one-group CBMR.

  • moderators (str or obj:list or obj:None, optional) – CBMR can accommodate study-level moderators (e.g. sample size, year of publication). Default is CBMR without study-level moderators.

  • model (: GeneralLinearModel, optional) – Stochastic models in CBMR. The available options are

  • penalty (the only available option is Firth-type) –

  • Currently

  • penalty

  • function (which penalizes likelihood) –

  • estimates. (by Jeffrey's invariant prior and guarantees convergent) –

  • spline_spacing (int, optional) –

  • bases (Spatial structure of foci counts is parameterized by coefficient of cubic B-spline) –

  • spacing (in CBMR. Spatial smoothness in CBMR is determined by spline) –

  • across (which is shared) –

  • x

  • y

  • dimension. (z) –

  • template). (Default is 10 (20mm with 2mm brain atlas) –

  • n_iters (int, optional) – Number of iterations limit in optimisation of log-likelihood function. Default is 10000.

  • lr (float, optional) – Learning rate in optimization of log-likelihood function. Default is 1e-2 for Poisson and clustered NB model, and 1e-3 for NB model.

  • lr_decay (float, optional) – Multiplicative factor of learning rate decay. Default is 0.999.

  • tol (float, optional) – Stopping criteria w.r.t difference of log-likelihood function in two consecutive iterations. Default is 1e-2

  • device (string, optional) – Device type (‘cpu’ or ‘cuda’) represents the device on which operations will be allocated Default is ‘cpu’

  • **kwargs – Keyword arguments. Arguments for the Estimator can be assigned here, Another optional argument is mask.

Variables:
  • masker (NiftiMasker or similar) – Masker object.

  • inputs (dict) – Inputs to the Estimator. For CBMR estimators, there is only multiple keys: coordinates, mask_img (Niftiimage of brain mask), id (study id), studies_by_groups (study id categorized by groups), all_group_moderators (study-level moderators categorized by groups if exist), coef_spline_bases (spatial matrix of coefficient of cubic B-spline bases in x,y,z dimension), foci_per_voxel (voxelwise sum of foci count across studies, categorized by groups), foci_per_study (study-wise sum of foci count across space, categorized by groups).

Notes

Available correction methods: CBMRInference().

Methods

fit(dataset[, drop_invalid])

Fit Estimator to Dataset.

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 Dataset.

Parameters:
  • dataset (Dataset) – Dataset object to analyze.

  • drop_invalid (bool, optional) – Whether to automatically ignore any studies without the required data or not. Default is False.

Returns:

Results of Estimator fitting.

Return type:

MetaResult

Variables:

inputs (dict) – Inputs used in _fit.

Notes

The fit method is a light wrapper that runs input validation and preprocessing before fitting the actual model. Estimators’ individual “fitting” methods are implemented as _fit, although users should call fit.

get_params(deep=True)[source]

Get parameters for this estimator.

Parameters:

deep (bool, default=True) – If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns:

params – Parameter names mapped to their values.

Return type:

dict

classmethod load(filename, compressed=True)[source]

Load a pickled class instance from file.

Parameters:
  • filename (str) – Name of file containing object.

  • compressed (bool, default=True) – If True, the file is assumed to be compressed and gzip will be used to load it. Otherwise, it will assume that the file is not compressed. Default = True.

Returns:

obj – Loaded class object.

Return type:

class object

save(filename, compress=True)[source]

Pickle the class instance to the provided file.

Parameters:
  • filename (str) – File to which object will be saved.

  • compress (bool, optional) – If True, the file will be compressed with gzip. Otherwise, the uncompressed version will be saved. Default = True.

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

Examples using nimare.meta.cbmr.CBMREstimator

Coordinate-based meta-regression algorithms

Coordinate-based meta-regression algorithms