I’m doing an ML study. I’ve used surv.penalized for lasso Penalized Cox Regression Learner, and get the non-zero coefficients. And it seems to work i.e. I do get some non-zero coefficients and the rest go to zero. Is there a way to extract coefficients and their names that are not zero?
my codes as follows:
``` r
library(mlr3extralearners)
library(mlr3proba)
#> Loading required package: mlr3
task = tsk("rats")
penalized =lrn("surv.penalized", lambda1=16.86)
penalized$train(task)
#> Warning: package 'survival' was built under R version 4.4.1
#> # nonzero coefficients: 3# nonzero coefficients: 2 # nonzero coefficients: 2 # nonzero coefficients: 2 # nonzero coefficients: 2 # nonzero coefficients: 2
<sup>Created on 2024-07-10 with reprex v2.1.0</sup>
I want to extract the name and value of non-zero coefficients. How can I do that?