Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't turn sparse matrix into dense matrix for glmnet prediction #1210

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

EmilHvitfeldt
Copy link
Member

What the title says:

there isn't really an easy way to test for this. This doesn't show up in our current tests as this is outside the scope of {sparsevctrs}

@@ -249,7 +249,7 @@ set_pred(
args =
list(
object = expr(object$fit),
newx = expr(as.matrix(new_data[, rownames(object$fit$beta), drop = FALSE])),
Copy link
Member Author

Choose a reason for hiding this comment

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

before we would call as.matrix() on anything before passing it to the predict method for the engine.

However if the data is a sparse matrix, we don't want to do that as {glmnet} is happy to receive it

Copy link
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.

Awesome!

I do think we ought find a way to test this before merging, either with a verbose_materialize and/or just passing some sparse data and making sure output looks like something we'd expect.

@EmilHvitfeldt
Copy link
Member Author

i got it done with some mocking 🎉

ba56e2a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants