Skip to contents

Fit one POWERUP XGBoost model for each requested perturbation in prepared POWERUP data returned by prepare_powerup_data().

Usage

fit_powerup_models(
  reference_data,
  models_to_make = NULL,
  perturbation_tags = "ko_",
  response_cutoff = 0.5,
  decreasing = FALSE,
  nfolds = 3,
  nrepeats = 3,
  nrounds = 200,
  min_score = 0.01,
  max_depth = 3,
  f_subsample = 1,
  shuffle = FALSE,
  seed = 1L,
  n_threads = 4,
  xgb_params = NULL,
  cor_n_features = NULL,
  shap_top_n = 100L
)

Arguments

reference_data

Prepared POWERUP data returned by prepare_powerup_data(), or a data frame containing requested perturbation responses and predictors.

models_to_make

Optional character vector naming perturbations to model. When reference_data is prepared POWERUP data, defaults to all prepared perturbations.

perturbation_tags

Character vector of prefixes used to identify response columns when reference_data is a data frame.

response_cutoff

Default biological response cutoff used to define target events for classification-style summaries and downstream event probabilities.

decreasing

If TRUE, values at or below response_cutoff define the target event; otherwise values at or above the cutoff define the target event.

nfolds

Number of cross-validation folds.

nrepeats

Number of repeated cross-validation runs.

nrounds

Maximum number of XGBoost boosting rounds.

min_score

Minimum mean R-squared required to retain a fitted model.

max_depth

Maximum tree depth.

f_subsample

Fraction of training rows sampled for each boosting round.

shuffle

If TRUE, shuffle response values before model fitting.

seed

Base random seed. A deterministic perturbation-specific seed is derived from this value so model results do not depend on target order. Both values are stored in each returned model object as seed and target_seed.

n_threads

Number of threads passed to XGBoost.

xgb_params

Optional named list overriding supported XGBoost parameters.

cor_n_features

Optional number of target-correlated features to retain. When set, features are ranked by absolute correlation within each cross-validation training fold and reranked using all training samples for the final refit. NULL disables correlation filtering.

shap_top_n

Maximum number of non-intercept SHAP features retained per sample before remaining contributions are collapsed into __other__.

Value

A named list of POWERUP model objects, one per requested perturbation.

Examples

if (FALSE) { # \dontrun{
prepared <- prepare_powerup_data(gene_expression, response, user_matrix = user_matrix)
models <- fit_powerup_models(prepared)
} # }