Uses glmnet
or cv.glmnet
to fit
the entire LASSO path for post-processing the individual trees of a
tree-based ensemble (e.g., a random forest).
isle_post(
X,
y,
newX = NULL,
newy = NULL,
cv = FALSE,
nfolds = 5,
family = NULL,
loss = "default",
offset = NULL,
...
)
A list with two components:
results
A data frame with one row for each value of lambda in the coefficient path and columns giving the corresponding number of trees/non-zero coefficients, error metric(s), and the corresponding value of lambda.
The fitted glmnet
or
cv.glmnet
object.
A matrix of training predictions, one column for each tree in the ensemble.
Vector of training response values. See glmnet
for acceptable values (e.g., numeric for family = "gaussian"
).
Same as argument X
, but should correspond to an
independent test set. (Required whenever cv = FALSE
.)
Same as argument y
, but should correspond to an
independent test set. (Required whenever cv = FALSE
.)
Logical indicating whether or not to use n-fold cross-validation.
Default is FALSE
(Must be TRUE
whenever newX = NULL
and
newy = NULL
.)
Integer specifying the number of folds to use for
cross-validation (i.e., whenever cv = TRUE
). Default is FALSE
.
The model fitting family (e.g., family = "binomial"
for
binary outcomes); see glmnet
for details on acceptable
values.
Optional character string specifying the loss to use for
n-fold cross-validation. Default is "default"
; see
cv.glmnet
for details. (Only used when
cv = TRUE
.)
Optional value for the offset. Default is NULL
, which
corresponds to no offset.
Additional (optional) arguments to be passed on to
glmnet
(e.g., intercept = FALSE
).