Skip to content

Make predict() work with sparse data#261

Merged
EmilHvitfeldt merged 6 commits intomainfrom
sparsevctrs-predict
Sep 26, 2024
Merged

Make predict() work with sparse data#261
EmilHvitfeldt merged 6 commits intomainfrom
sparsevctrs-predict

Conversation

@EmilHvitfeldt
Copy link
Copy Markdown
Member

Ref: #239

This PR:

  • turns sparse matrices to sparse tibbles early in predict() (same convention as with everything else)
  • tests that predict works with sparse tibbles and sparse matrices
  • add news

expect_snapshot(wf_fit <- fit(wf_spec, hotel_data))
})

test_that("sparse tibble can be passed to `predict()", {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only doing 1 test since it should be able to predict regardless of how the workflow was created

Copy link
Copy Markdown
Contributor

@simonpcouch simonpcouch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right on.🎸

Ran these tests locally and saw failures due to using CRAN recipes rather than dev--could we add a Remotes here?

Also, as of now, these tests are not run on CI because glmnet isn't installed. I'm 50-50 on whether we ought to, and support you adding a glmnet suggests if you think that's the right move to test these well.

@EmilHvitfeldt EmilHvitfeldt merged commit 35131ce into main Sep 26, 2024
@EmilHvitfeldt EmilHvitfeldt deleted the sparsevctrs-predict branch September 26, 2024 22:12
@github-actions
Copy link
Copy Markdown

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants