Skip to contents

This function trains a Multi-Variate Pattern Analysis (MVPA) model on the provided data, taking care of feature selection, parameter tuning, and model fitting.

Usage

# S3 method for mvpa_model
train_model(
  obj,
  train_dat,
  y,
  indices,
  param = NULL,
  wts = NULL,
  tune_reps = 10,
  ...
)

Arguments

obj

An object of class mvpa_model, specifying the MVPA problem.

train_dat

Training data, an instance of class ROIVolume or ROISurface.

y

The dependent variable (response variable), either a numeric vector or a factor.

indices

The spatial indices associated with each column.

param

Optional tuning parameters (default: NULL). If not provided, the function will perform tuning using tune_grid.

wts

Optional case weights (default: NULL).

tune_reps

The number of bootstrap replications for parameter tuning (default: 10), only used when param is NULL.

...

Additional arguments passed to other methods.

Value

A model fit object containing the trained model, its fit, the model type (classification or regression), the best tuning parameters, the voxel indices, and the feature mask.