I've searched far and wide but just not finding information. Is there a way to fit a model with the tidymodels set of packages (recipe, tune, rsample, tune...), fit the best model, and then export that model to a pmml format. I tinkered with the pmml package without any luck.
set.seed(123)
library(parsnip)
library(recipes)
#> Loading required package: dplyr
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
#>
#> Attaching package: 'recipes'
#> The following object is masked from 'package:stats':
#>
#> step
library(workflows)
library(modeldata)
data("Sacramento")
base_wf <- workflow() %>%
add_formula(price ~ type + sqft + beds + baths)
lm_spec <- linear_reg() %>%
set_engine("lm")
lm_fit <- base_wf %>%
add_model(lm_spec) %>%
fit(Sacramento)
library(pmml)
#> Loading required package: XML
lm_fit %>% extract_fit_parsnip() %>% pmml()
#> Error in UseMethod("pmml"): no applicable method for 'pmml' applied to an object of class "c('_lm', 'model_fit')"
Created on 2024-05-06 with reprex v2.1.0