Skip to content

Commit

Permalink
document toggle_sparsity()
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilHvitfeldt committed Jan 17, 2025
1 parent 3836124 commit 2162736
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions R/sparsevctrs.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ is_sparse_matrix <- function(x) {
methods::is(x, "sparseMatrix")
}

# This function takes a workflow and its data. If the model supports sparse data
# And there is a recipe, then it uses `should_use_sparsity()` to determine
# whether all the `sparse = "auto"` should be turned to `"yes"` or `"no"` in the
# recipe.
#
# Done using flow chart in https://github.com/tidymodels/workflows/issues/271
toggle_sparsity <- function(object, data) {
if (
allow_sparse(object$fit$actions$model$spec) &&
Expand Down

0 comments on commit 2162736

Please sign in to comment.