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

Add butcher support for multilevelmod / lme4 #198

Open
bshor opened this issue May 25, 2021 · 5 comments
Open

Add butcher support for multilevelmod / lme4 #198

bshor opened this issue May 25, 2021 · 5 comments
Labels
feature a feature request or enhancement

Comments

@bshor
Copy link

bshor commented May 25, 2021

I am trying to use the butcher package to cut down on the size of fitted objects, in my case fits using lme4::lmer. That led me to parsnip, then here!

I would have thought this would work, but it doesn't.

library(multilevelmod)
#> Loading required package: parsnip
data(sleepstudy, package = "lme4")

mixed_model_spec <- linear_reg() %>% set_engine("lmer")

mixed_model_fit <- 
  mixed_model_spec %>% 
  fit(Reaction ~ Days + (Days | Subject), data = sleepstudy)

mixed_model_fit

Checking the size of the fits:

> object.size(mixed_model_fit)
67120 bytes
> object.size(butcher(mixed_model_fit))
67120 bytes

What am I missing?

@hfrick
Copy link
Member

hfrick commented May 26, 2021

Hi @bshor ! I think you don't see any changes because butcher does not have methods for models from lme4: The documentation for butcher says

The current axe methods have been tested on all parsnip model objects as listed here. If you are working with a new model object that could benefit from any kind of axing, we would love for you to make a pull request!

and your model is a not listed there, neither did I see anything in the butcher repo.

@DavisVaughan is that in scope for butcher?

@hfrick hfrick transferred this issue from tidymodels/multilevelmod May 26, 2021
@DavisVaughan
Copy link
Member

Yes I think so!

@bshor
Copy link
Author

bshor commented May 26, 2021

Thanks! I had thought by using multilevelmod it would somehow automatically add lmer to the list. I may have to do it manually (never having done it before!).

@juliasilge juliasilge changed the title Help with butcher() Add butcher support for multilevelmod / lme4 May 26, 2021
@juliasilge juliasilge added the feature a feature request or enhancement label May 26, 2021
@bbolker
Copy link

bbolker commented Apr 3, 2023

I would be willing to help with this but would have to familiarize myself with the package - would need to do some careful tests to know which components could be removed with what loss of functionality.

@juliasilge
Copy link
Member

That would be super helpful @bbolker! 🙌 This package has a vignette on how to add a new model, and I feel like the tests for GAMs are a pretty good example to look at.

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

No branches or pull requests

5 participants