fit_inspre_from_X: Fits inverse sparse regression model.

View source: R/inspre.R

fit_inspre_from_XR Documentation

Fits inverse sparse regression model.

Description

See also inspre::inspre() for more details.

Usage

fit_inspre_from_X(
  X,
  targets,
  weighted = TRUE,
  max_med_ratio = NULL,
  filter = TRUE,
  rho = 100,
  lambda = NULL,
  lambda_min_ratio = 0.01,
  nlambda = 20,
  alpha = 0,
  gamma = NULL,
  its = 100,
  delta_target = 1e-04,
  verbose = 1,
  train_prop = NULL,
  cv_folds = 0,
  mu = 10,
  tau = 1.5,
  solve_its = 10,
  ncores = 1,
  warm_start = FALSE,
  min_nz = 1e-05,
  constraint = "UV",
  DAG = FALSE
)

Arguments

X

observations x features data matrix. Colnames represent feature names. Rownames also correspond to feature names indicating an intervention was applied to that feature in that sample, with "control" indicating no intervention.

targets

sequence of strings of length total number of observations (rows in X). Entries are either "control" to indicate no intervention or the name of a column in'X' to indicate the intervened on variable.

weighted

Boolean. TRUE to calculate weights from SEs and use them, FALSE for unweighted. Default TRUE.

max_med_ratio

Float or NULL. Ignored if 'weight=FALSE'. If 'weight=TRUE', this is the ratio of the maximum weight to median weight. 'NULL' for no restriction on the ratio. This can be useful to set if you have some entries with very small standard error, to prevent the algorithm from focusing exclusively on the entries with very small SE.

filter

Bool. True to filter the produced TCE matrix with 'fitler_tce'.

rho

Float. Initial learning rate for ADMM.

lambda

Float, sequence of floats of NULL. L1 regularization strength on inverse of X. If NULL, a logarithmicallly spaced set of values between the maximimum absolute off diagonal element of X and lambda_min_ratio times this value will be used.

lambda_min_ratio

Float, ratio of maximum lambda to minimum lambda.

nlambda

Integer. Number of lambda values to try.

alpha

Float between 0 and 1 or NULL. If > 0, the model will be fit once with gamma = 0 to find L0, then all subsequent fits will use gamma = alpha * L0 / D. Set to NULL to provide gamma directly.

gamma

Float or sequence of nlambda floats or NULL. Determinant regularization strength to use (for each lambda value). It is recommended to set alpha rather than setting this directly.

its

Integer. Maximum number of iterations.

delta_target

Float. Target change in solution.

verbose

0, 1 or 2. 2 to print convergence progress for each lambda, 1 to print convergence result for each lambda, 0 for no output.

train_prop

Float between 0 and 1. Proportion of data to use for training in cross-validation. NOT USED.

cv_folds

Integer. Number of cross-validation folds to perform.

mu

rho modification parameter for ADMM. Rho will be increased/decreased when the dual constrant and primal constraint are off by a factor of > mu.

tau

rho modification parameter for ADMM. When called for, rho will be increased/decreased by the factor tau.

solve_its

Integer, number of iterations of bicgstab/lasso to run for each U and V update.

ncores

Integer, number of cores to use.

warm_start

Logical. Whether to use previous lambda value result as starting point for next fit.

constraint

One of "UV" or "VU". Constraint to use.

DAG

Bool. True to restrict solutions to approximate DAGs. Useful to set to TRUE if you are having convergence issues with 'DAG=FALSE' as the more restricted model can be easier to fit.


brielin/inspre documentation built on Dec. 3, 2023, 4:55 a.m.