Run Global (Whole-Brain) MVPA Analysis
Source:R/allgeneric.R, R/global_analysis.R, R/pattern_model.R
run_global.RdTrain a single classifier on ALL features (parcels or voxels) with cross-validation, and compute per-feature importance via Haufe et al. (2014) activation patterns.
Usage
run_global(model_spec, ...)
# S3 method for class 'mvpa_model'
run_global(
model_spec,
X = NULL,
summary_fun = NULL,
return_fits = FALSE,
aggregation = c("mean", "sum", "maxabs"),
preflight = c("warn", "error", "off"),
...
)
# Default S3 method
run_global(model_spec, ...)
# S3 method for class 'pattern_model'
run_global(
model_spec,
return_fits = isTRUE(model_spec$keep_fold_fits),
refit = model_spec$refit,
preflight = c("warn", "error", "off"),
...
)Arguments
- model_spec
An
mvpa_modelspecification.- ...
Additional arguments (currently unused).
- X
Optional pre-computed T x P feature matrix. If NULL, extracted from
model_spec$datasetviaget_feature_matrix.- summary_fun
Function to summarize activation pattern matrix rows into a scalar importance per feature. Default: L2 norm.
- return_fits
Retain the per-fold
pattern_fitobjects.- aggregation
How to aggregate multi-basis feature importance (default "mean").
- preflight
Preflight validation level (
"warn","error", or"off"); the pattern model runs a lightweight specification check.- refit
Also fit the model on all training rows (descriptive fit).
Architecture TODO
run_global currently uses a dedicated global CV/training pipeline
rather than dispatching through fit_roi. This is intentional
for now; future cleanup may unify global and ROI fitting interfaces.
Examples
# \donttest{
ds <- gen_sample_dataset(c(5,5,5), 40, nlevels=2, blocks=3)
cval <- blocked_cross_validation(ds$design$block_var)
mdl <- load_model("sda_notune")
mspec <- mvpa_model(mdl, ds$dataset, ds$design,
"classification", crossval=cval)
result <- run_global(mspec)
# }