fitLinearLogicModel: Linear models based on logic terms

View source: R/logic.boosting.R

fitLinearLogicModelR Documentation

Linear models based on logic terms

Description

This function fits a linear or logistic regression model (based on the type of outcome) using the supplied logic terms, e.g., $disj from a fitted logicDT model.

Usage

fitLinearLogicModel(
  X,
  y,
  Z = NULL,
  disj,
  Z.interactions = TRUE,
  type = "standard",
  s = NULL,
  ...
)

Arguments

X

Matrix or data frame of binary input data. This object should correspond to the binary matrix for fitting the model.

y

Response vector. 0-1 coding for binary outcomes.

Z

Optional quantitative covariables supplied as a matrix or data frame. Only used (and required) if the model was fitted using them.

disj

Integer matrix of logic terms. As in logicDT, each row corresponds to a term/conjunction. Negative values indicate negations. The absolute values of an entry correspond to the predictor index in X.

Z.interactions

Shall interactions with the continuous covariable Z be taken into account by including products of the terms with Z?

type

Type of linear model to be fitted. Either "standard" (without regularization), "lasso" (LASSO) or "cv.lasso" (LASSO with cross-validation for automatically configuring the complexity penalty).

s

Regularization parameter. Only used if type = "lasso" is set.

...

Additional parameters passed to glmnet or cv.glmnet if the corresponding model type was chosen.

Details

For creating sparse final models, the LASSO can be used for shrinking unnecessary term coefficients down to zero (type = "lasso"). If the complexity penalty s shall be automatically tuned, cross-validation can be employed (type = "cv.lasso"). However, since other hyperparameters also have to be tuned when fitting a linear boosting model such as the complexity penalty for restricting the number of variables in the terms, manually tuning the LASSO penalty together with the other hyperparameters is recommended. For every hyperparameter setting of the boosting itself, the best corresponding LASSO penalty s can be identified by, e.g., choosing the s that minimizes the validation data error. Thus, this hyperparameter does not have to be explicitly tuned via a grid search but is induced by the setting of the other hyperparameters. For finding the ideal value of s using independent validation data, the function get.ideal.penalty can be used.

Value

A linear.logic model. This is a list containing the logic terms used as predictors in the model and the fitted glm model.

References

  • Tibshirani, R. (1996). Regression Shrinkage and Selection via the Lasso. Journal of the Royal Statistical Society. Series B (Methodological), 58(1), 267–288. doi: 10.1111/j.2517-6161.1996.tb02080.x

  • Friedman, J., Hastie, T., & Tibshirani, R. (2010). Regularization Paths for Generalized Linear Models via Coordinate Descent. Journal of statistical software, 33(1), 1–22. doi: 10.18637/jss.v033.i01


logicDT documentation built on Jan. 14, 2023, 5:06 p.m.