fit_models_in_parallel: Make a list of models and save as file (parallel)

View source: R/make_xgb_models.R

fit_models_in_parallelR Documentation

Make a list of models and save as file (parallel)

Description

This function creates an XGBoost model for each perturbation given, saves the list of models, and returns a message.

Usage

fit_models_in_parallel(
  perturbs,
  chunk_size = 20,
  model_dataset,
  response_cutoff = 0.5,
  weight_cap = 0,
  nfolds = 3,
  nrepeats = 1,
  nrounds = 200,
  min_score = 0.5,
  max_depth = 3,
  f_subsample = 1,
  skip_eval = FALSE,
  shuffle = FALSE,
  xgb_params = NULL,
  n_threads = 4,
  use_gpu = TRUE,
  gpu_id = c(0),
  seed = 123,
  path = NULL
)

Arguments

perturbs

A vector of perturbations.

model_dataset

A dataframe with the perturbation in a column and all other predictors. Sample names are row names.

response_cutoff

The value above which the sample is considered sensitive.

weight_cap

The maximum weight of each minority case when resampling. Set to 0 if no resampling needed.

nfolds

The number of folds in k-fold cross validation.

nrepeats

The number of repeats in k-fold cross validation.

nrounds

The maximum number of trees in the XGBoost model.

min_score

The minimum number of r^2 value for a model to be considered for the next stage (making predictions and calculating SHAP values).

skip_eval

Default = FALSE. If TRUE, k-fold CV will not be conducted and instead all models will be pushed to the next stage.

use_gpu

Default = TRUE. Set to FALSE if using CPU.

seed

Random seed

path

Folder path (e.g. "/home/test/models") to save models in.

chunk_indx

Integer index used, for progress report.

Examples

fit_models_in_parallel(my_data, c("ko_ctnnb1","ko_myod1"))

Mushriq/mixmap documentation built on Jan. 28, 2024, 7:22 p.m.