This document outlines the steps to integrate the Multi-Dimensional Signed Representational Voxel Encoding (MS-ReVE) approach into the rMVPA
package, primarily through a new contrast_rsa_model
.
Always check off the items that are done. Conceptual plan in in signed_rsa_proposal.md
[ ] Create msreve_design
Object:
msreve_design
.mvpa_design
object.contrast_matrix
(C
, K x Q
).orthogonalize_contrasts(C)
for users.[ ] Develop compute_crossvalidated_means_sl
Helper Function:
mvpa_dataset
subset for the searchlight (sl_data
), mvpa_design
, cv_spec
, estimation_method
parameter.cv_spec
object is generated by the user from functions in R/crossval.R
(e.g., blocked_cross_validation(mvpa_design$block_var)
), defining the specific CV strategy.K x V_sl
matrix Û_sl
based on cross-validation folds defined in cv_spec
(using helpers like train_indices()
and get_nfolds()
).estimation_method
s (e.g., "average_betas", potentially others later).[ ] Create contrast_rsa_model
Specification:
contrast_rsa_model
(inheriting from mvpa_model_spec
which itself inherits from model_spec
).contrast_rsa_model(...)
.create_model_spec("contrast_rsa_model", ...)
internally to properly instantiate the model object.mvpa_dataset
.msreve_design
object.estimation_method
, regression_type
, output_metric
.[ ] Implement train_model.contrast_rsa_model
Method:
obj
(contrast_rsa_model
), sl_data
, sl_info
(containing center voxel index/ID).compute_crossvalidated_means_sl
to get Û_sl
.Ĝ_sl = Û_sl %*% t(Û_sl)
.Ĝ_sl
(dvec_sl
).X_sl
from obj$design$contrast_matrix
. (Reuse/adapt rsa_model_mat
logic). Handle block_var
exclusions if necessary.obj$regression_type
) to get β_sl
(Q-vector). Reuse run_lm
, run_lm_constrained
, etc.Δ_sl = t(Û_sl) %*% C
(V_sl x Q
matrix).Δ_{v_c,sl}
(Q-vector) using sl_info
.result_vector
based on obj$output_metric
(e.g., β_sl * Δ_{v_c,sl}
).result_vector
(Q-dimensional).[ ] Update Searchlight Machinery:
sl_info
object passed to the iterator function.[ ] Create Iterator Function msreve_iterate
:
model_spec
(contrast_rsa_model
), slight
(list of searchlights), cind
(center indices).sl_data
) and center voxel info (sl_info
) for each searchlight.train_model.contrast_rsa_model(model_spec, sl_data, sl_info, ...)
[ ] Create Combiner Function combine_msreve_standard
:
model_spec
, good_results
, bad_results
.good_results$id
.good_results$performance
.N_voxels x Q
matrix.Q
separate output maps (e.g., SparseNeuroVec
or NeuroSurfaceVector
), one per column (contrast). Name them appropriately.msreve_searchlight_result
) containing the list of these Q
maps.[ ] Implement run_searchlight.contrast_rsa_model
S3 Method:
run_searchlight_base
internally.mvpa_fun = msreve_iterate
.combiner = combine_msreve_standard
.contrast_rsa_model
.[ ] Refine Documentation:
[ ] (Optional) Implement run_regional.contrast_rsa_model
:
train_model.contrast_rsa_model
for ROI-based analysis (analogous to other run_regional
methods).process_roi.contrast_rsa_model
method is needed if whole-ROI processing differs significantly from searchlight processing beyond what train_model
can handle.Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.