View source: R/contrast_rsa_model.R
train_model.contrast_rsa_model | R Documentation |
This function implements the core logic for the MS-ReVE analysis within a single searchlight or region.
## S3 method for class 'contrast_rsa_model'
train_model(obj, sl_data, sl_info, cv_spec, ...)
obj |
An object of class |
sl_data |
The data matrix for the current searchlight (samples x voxels). |
sl_info |
A list containing information about the current searchlight,
including |
cv_spec |
The cross-validation specification object (e.g., from |
... |
Additional arguments (currently ignored). |
A named list where each element corresponds to a requested 'output_metric' from the 'obj$output_metric' vector. Each element is:
For metrics like "beta_delta", "beta_only", "delta_only": A Q-length named vector where values are indexed by contrast and names match the contrast_matrix column names (Q = number of contrasts)
For metrics like "recon_score", "composite": A single numeric value
The list will have an attribute "na_reason" if any metric calculation failed, which can be used for diagnostics.
For example, if 'obj$output_metric = c("beta_delta", "recon_score")', the returned list will have two elements: '$beta_delta' (a Q-length vector) and '$recon_score' (a single value).
# This example shows the structure of the returned list but doesn't actually run the function
# For a multi-metric model: output_metric = c("beta_delta", "recon_score", "beta_only")
# With 2 contrasts named "contrast1" and "contrast2", the return structure would be:
#
# result <- list(
# beta_delta = c(contrast1 = 0.23, contrast2 = -0.15),
# recon_score = 0.72,
# beta_only = c(contrast1 = 1.45, contrast2 = 0.88)
# )
#
# Accessing individual metrics:
# result$beta_delta["contrast1"] # Value for first contrast's beta*delta
# result$recon_score # Single value for reconstruction score
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.