nimare.meta.cbma.ale.SCALE

class SCALE(xyz, n_iters=5000, n_cores=1, kernel_transformer=<class 'nimare.meta.kernel.ALEKernel'>, memory=Memory(location=None), memory_level=0, **kwargs)[source]

Bases: CBMAEstimator

Specific coactivation likelihood estimation.

This method was originally introduced in Langner et al.[1].

Changed in version 0.14.0: Use direct empirical voxelwise permutation p-values and add voxel-level Monte Carlo family-wise error correction.

Changed in version 0.14.0: Stream permutation exceedance counts instead of retaining a full voxelwise permutation null matrix in the main SCALE fit path.

Changed in version 0.2.1:

  • New parameters: memory and memory_level for memory caching.

Changed in version 0.0.12:

  • Remove unused parameters voxel_thresh and memory_limit.

  • Use memmapped array for null distribution.

  • Use a 4D sparse array for modeled activation maps.

Changed in version 0.0.10: Replace ijk with xyz. This should be easier for users to collect.

Parameters:
  • xyz ((N x 3) numpy.ndarray) –

    Numpy array with XYZ coordinates. Voxels are rows and x, y, z (meaning coordinates) values are the three columnns.

    Changed in version 0.0.12: This parameter was previously incorrectly labeled as “optional” and indicated that it supports tab-delimited files, which it does not (yet).

  • n_iters (int, default=5000) – Number of iterations for statistical inference. Default: 5000

  • n_cores (int, default=1) – Number of processes to use for meta-analysis. If -1, use all available cores. Default: 1

  • kernel_transformer (KernelTransformer, optional) – Kernel with which to convolve coordinates from dataset. Default is ALEKernel.

  • memory (instance of joblib.Memory, str, or pathlib.Path) – Used to cache the output of a function. By default, no caching is done. If a str is given, it is the path to the caching directory.

  • memory_level (int, default=0) – Rough estimator of the amount of memory used by caching. Higher value means more memory for caching. Zero means no caching.

  • **kwargs – Keyword arguments. Arguments for the kernel_transformer can be assigned here, with the prefix ‘kernel__’ in the variable name.

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

  • inputs (dict) – Inputs to the Estimator. For CBMA estimators, there is only one key: coordinates. This is an edited version of the dataset’s coordinates DataFrame.

  • null_distributions (dict of numpy.ndarray) –

    Null distribution information. Entries are added to this attribute if and when the corresponding method is applied.

    Important

    The voxel-wise null distributions used by this Estimator are very large, so they are not retained as Estimator attributes.

    If correct_fwe_montecarlo() is applied:

    • values_level-voxel_corr-fwe_method-montecarlo: The maximum summary statistic value from each SCALE permutation. An array of shape (n_iters,).

Notes

SCALE uses voxel-specific empirical null distributions derived from the supplied reference coordinate pool. NiMARE therefore supports voxel-level Monte Carlo FWE correction for SCALE, but does not implement cluster-level Monte Carlo FWE correction.

References

Methods

correct_fwe_montecarlo(result[, ...])

Perform voxel-level Monte Carlo FWE correction for SCALE.

fit(dataset[, drop_invalid, ma_maps])

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.

correct_fwe_montecarlo(result, voxel_thresh=None, n_iters=5000, n_cores=1, vfwe_only=True)[source]

Perform voxel-level Monte Carlo FWE correction for SCALE.

Notes

This method implements only voxel-level max-statistic correction. Cluster-level Monte Carlo FWE correction is not implemented for SCALE because the method uses voxel-specific empirical null distributions rather than a single global null model.

fit(dataset, drop_invalid=True, ma_maps=None)[source]

Fit Estimator to a collection.

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

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

  • ma_maps (scipy sparse matrix or sparse array, optional) – Precomputed study-wise MA maps aligned to the study ids in dataset. When provided, the estimator will reuse these maps instead of recomputing them from coordinates. These are typically 2D study-by-masked-voxel sparse matrices.

Returns:

Results of Estimator fitting.

Return type:

MetaResult

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