Skip to contents

Baseline analysis that classifies target-domain trials by correlating them directly with source-domain prototypes (means over repeats) without any adaptation. Serves as a comparator for REMAP-RRR.

Usage

naive_xdec_model(
  dataset,
  design,
  link_by = NULL,
  return_predictions = TRUE,
  performance = NULL,
  ...
)

Arguments

dataset

mvpa_dataset with train_data (source) and test_data (target)

design

mvpa_design with y_train/y_test and optional `link_by` column present in both train/test designs. If `link_by` is NULL, prototypes are formed by the training labels `y_train` and evaluated against `y_test`.

Optional character; if provided, prototypes and observed labels are keyed by this column instead of y.

return_predictions

logical; keep per-ROI predictions.

performance

Optional user-supplied performance function. When non-`NULL`, must be a function that accepts the classification result object (with fields `observed`, `predicted`, `probs`, `testind`, `test_design`) and returns a named numeric vector of metrics. Routed through [get_custom_perf()], which annotates it as `"custom"`; this disables the optimised fast-metric kernel and ensures the user's function is always called on the full result object. When `NULL`, the default binary / multiclass / regression performance helper is used.

...

Additional arguments (currently unused).

Value

model spec object of class `naive_xdec_model` for use with `run_regional()` or `run_searchlight()`.

Details

The term "naive" is a technical designation meaning "without domain adaptation" (i.e., direct prototype matching). It serves as the principled baseline for evaluating domain-adaptive methods like REMAP-RRR. Also known as "zero-shot transfer" or "direct transfer" in machine learning literature.

Examples

ds <- gen_sample_dataset(c(5, 5, 5), 20, external_test = TRUE)
model <- naive_xdec_model(ds$dataset, ds$design)

# Custom metric: mean probability assigned to the true class
custom_fun <- function(result) {
  probs <- as.matrix(result$probs)
  obs   <- as.character(result$observed)
  true_p <- probs[cbind(seq_along(obs), match(obs, colnames(probs)))]
  c(mean_true_prob = mean(true_p))
}
model2 <- naive_xdec_model(ds$dataset, ds$design, performance = custom_fun)
res <- run_regional(model2, ds$dataset$mask)
#> INFO [2026-10-16 11:46:29] 
#> MVPA Iteration Complete
#> - Total ROIs: 1
#> - Processed: 1
#> - Skipped: 0
#> INFO [2026-10-16 11:46:29] run_regional: 1 ROIs processed (success=1, errors=0)
res$performance_table
#> # A tibble: 1 × 2
#>   roinum mean_true_prob
#>    <int>          <dbl>
#> 1      1          0.197