File tree Expand file tree Collapse file tree 1 file changed +15
-14
lines changed
Expand file tree Collapse file tree 1 file changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -3,31 +3,32 @@ is_sparse_matrix <- function(x) {
33}
44
55toggle_sparsity <- function (object , data ) {
6- toggle_sparse <- " no"
7-
8- if (allow_sparse(expect_spec_parsnip(object ))) {
9- if (has_preprocessor_recipe(object )) {
10- est_sparsity <- recipes :: .recipes_estimate_sparsity(
11- extract_preprocessor(object )
12- )
13- } else {
14- est_sparsity <- sparsevctrs :: sparsity(data , sample = 1000 )
15- }
6+ if (
7+ allow_sparse(object $ fit $ actions $ model $ spec ) &&
8+ has_preprocessor_recipe(object )
9+ ) {
10+ est_sparsity <- recipes :: .recipes_estimate_sparsity(
11+ extract_preprocessor(object )
12+ )
1613
1714 pred_log_fold <- pred_log_fold(
1815 est_sparsity ,
1916 extract_spec_parsnip(object )$ engine ,
2017 nrow(data )
2118 )
19+
20+ toggle_sparse <- " no"
21+
2222 if (pred_log_fold > 0 ) {
2323 toggle_sparse <- " yes"
2424 }
25+
26+ object $ pre $ actions $ recipe $ recipe <- recipes :: .recipes_toggle_sparse_args(
27+ object $ pre $ actions $ recipe $ recipe ,
28+ choice = toggle_sparse
29+ )
2530 }
2631
27- object $ pre $ actions $ recipe $ recipe <- recipes :: .recipes_toggle_sparse_args(
28- object $ pre $ actions $ recipe $ recipe ,
29- choice = toggle_sparse
30- )
3132 object
3233}
3334
You can’t perform that action at this time.
0 commit comments