@@ -23,14 +23,26 @@ linear_reg() %>%
2323 translate()
2424```
2525
26- For ` glmnet ` models, the full regularization path is always fit regardless of the
27- value given to ` penalty ` . Also, there is the option to pass multiple values (or
28- no values) to the ` penalty ` argument. When using the ` predict() ` method in these
29- cases, the return value depends on the value of ` penalty ` . When using
30- ` predict() ` , only a single value of the penalty can be used. When predicting on
31- multiple penalties, the ` multi_predict() ` function can be used. It returns a
32- tibble with a list column called ` .pred ` that contains a tibble with all of the
33- penalty results.
26+ ` linear_reg() ` requires a single value for the ` penalty ` argument (a number
27+ or ` tune() ` ). Despite this, the full regularization path is always fit
28+ regardless of the value given to ` penalty ` . To pass in a custom sequence of
29+ values for ` lambda ` , use the argument ` path_values ` in ` set_engine() ` . This
30+ will assign the value of the glmnet ` lambda ` parameter without disturbing
31+ the value given in ` linear_reg(penalty) ` . For example:
32+
33+ ``` {r glmnet-path}
34+ linear_reg(penalty = .1) %>%
35+ set_engine("glmnet", path_values = c(0, 10^seq(-10, 1, length.out = 20))) %>%
36+ set_mode("regression") %>%
37+ translate()
38+ ```
39+
40+ When using ` predict() ` , the single penalty value used for prediction is the one
41+ given to ` linear_reg() ` .
42+
43+ To predict on multiple penalties, the ` multi_predict() ` function can be used.
44+ It returns a tibble with a list column called ` .pred ` that contains a tibble
45+ with all of the penalty results.
3446
3547## stan
3648
0 commit comments