fit_model: Fit Model

View source: R/allgeneric.R

fit_modelR Documentation

Fit Model

Description

Fit a classification or regression model.

Usage

fit_model(
  obj,
  roi_x,
  y,
  wts,
  param,
  lev = NULL,
  last = FALSE,
  classProbs = FALSE,
  ...
)

Arguments

obj

A model fitting object.

roi_x

An ROI containing the training data.

y

The response vector.

wts

A set of case weights.

param

Tuning parameters.

lev

Factor levels (for classification).

last

Logical indicating if this is the last iteration.

classProbs

Logical indicating if class probabilities should be returned.

...

Additional arguments to be passed to the method-specific function.

Examples


  ds <- gen_sample_dataset(
    D = c(6, 6, 6), nobs = 20,
    response_type = "categorical",
    data_mode = "image", nlevels = 2
  )
  mdl <- load_model("sda_notune")
  mspec <- mvpa_model(
    model = mdl,
    dataset = ds$dataset,
    design = ds$design,
    model_type = "classification"
  )
  grid <- tune_grid(mspec, ds$dataset$train_data, ds$design$y_train, len = 1)
  fit <- fit_model(mspec, ds$dataset$train_data,
                   ds$design$y_train, wts = NULL, param = grid)


bbuchsbaum/rMVPA documentation built on June 10, 2025, 8:23 p.m.