Skip to content

5. Not all are currently working

Steven Paul Sanderson II, MPH edited this page Dec 5, 2023 · 4 revisions

Not all of the algorithms "supported" are currently working, which would mean they really are not supported, although we are trying. For example, the gee engine does not work, and this is because of the unique nature of the algorithm and that fact that in order for it to be supported by parsnip it had to have a work around added to it. We don't want users to have to build the formulas outside or recipes if they do not have to, so we strive to abstract this away by simply making it a parameter that gets passed. The official documentation for gee describes this.

Let's see how this fails.

library(tidyAML)
library(tidyverse)
library(recipes)
library(dplyr)
library(multilevelmod)

rec_obj <- recipe(mpg ~ ., data = mtcars)
frt_tbl <- fast_regression(
  .data = mtcars, 
  .rec_obj = rec_obj, 
  .parsnip_eng = c("gee"),
  .parsnip_fns = "linear_reg"
)
Error in terms.formula(f, specials = "id_var"): '.' in formula and no 'data' argument

Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"


frt_tbl
# A tibble: 1 × 8
  .model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw       fitted_wflw pred_wflw
      <int> <chr>           <chr>         <chr>        <list>     <list>     <list>      <list>   
1         1 gee             regression    linear_reg   <spec[+]>  <workflow> <NULL>      <NULL>  

It is possible to get the formula for the model like so:

> formula(prep(rec_obj))
mpg ~ cyl + disp + hp + drat + wt + qsec + vs + am + gear + carb
<environment: 0x000001c609e8cfa8>

The question is how do we modify this formula for the user behind the scenes so that all one has to do is provide an argument to a parameter like .id_var for it to work. This I think will require a fundamental shift in how the structure of the package is written towards a method dispatch type of framework.

Now working

This particular issue has now been fixed which can be seen at the roadmap here

Clone this wiki locally