Questions tagged [r-parsnip]

Parsnip is an R package providing a common interface for specifying a model.

43 questions
3
votes
1 answer

How to enable parallelization in tidymodels stacks::control_stack_grid()

I am attempting to use the tidymodels stacks package to perform ensemble modeling. Following the instructions provided in their article, I was able to reproduce the example successfully. However, when I added parallelization during hyperparameter…
littleworth
  • 4,781
  • 6
  • 42
  • 76
3
votes
1 answer

How do I extract the classification tree from this parsnip model in R?

I am working through 'Machine Learning & R Expert techniques for predictive modeling' by Brett Lantz. I am using the tidymodels suite as I try the example modeling exercises in R. I am working through chapter 5 in which you build a decision tree…
3
votes
1 answer

Create a multivariate matrix in tidymodels recipes::recipe()

I am trying to do a k-fold cross validation on a model that predicts the joint distribution of the proportion of tree species basal area from satellite imagery. This requires the use of the DiricihletReg::DirichReg() function, which in turn…
Sean McKenzie
  • 707
  • 3
  • 13
3
votes
1 answer

How to fit a model without an intercept using R tidymodels workflow?

How can I fit a model using this tidymodels workflow? library(tidymodels) workflow() %>% add_model(linear_reg() %>% set_engine("lm")) %>% add_formula(mpg ~ 0 + cyl + wt) %>% fit(mtcars) #> Error: `formula` must not contain the intercept…
David Rubinger
  • 3,580
  • 1
  • 20
  • 29
3
votes
1 answer

Stepwise Algorithm in Tidymodels

I found that the Stepwise Algorithm for variable selection implemented natively in R with step() is not integrated in Tidymodels. I do not know if there is a reason for not using it (because of better procedures), or is it simply a lacking feature.
Marco Repetto
  • 336
  • 2
  • 15
2
votes
1 answer

How to fit several different linear models on same dataset using tidymodels and workflowsets

I want to evaluate the performance of several (mostly) linear regression models on the same dataset. I thought maybe using tidymodels packages along with the workflowsets::workflow_set() might work. I followed the example here, but I cannot figure…
D Kincaid
  • 167
  • 1
  • 13
1
vote
1 answer

Using tidymodels in R, my BART workflow changes after I fit it once. Why?

I have been trying to train a BART model using the tidymodels framework but I am running into some problems. I can declare the model, the recipe, and the workflow alright, but once I fit the workflow, two unwanted things happen: The original model…
Martin
  • 13
  • 5
1
vote
1 answer

Build a tibble of parsnip_model calls with match.fun

Let's suppose I have a tibble like so: regression_to_parsnip_call_tbl <- tibble::tibble( engine = c( "lm", "brulee", "gee", "glm", "glmer", "glmnet", "gls", "h2o", "keras", "lme", "lmer", "spark", …
MCP_infiltrator
  • 3,961
  • 10
  • 45
  • 82
1
vote
1 answer

How do space-filling parameter grids change when we call them by parsnip and recipe packages?

According to this (https://dials.tidymodels.org/reference/grid_max_entropy.html) page, the output of a grid function may vary depending on whether we use a parameter object produced by parsnip and recipes, or we directly use a parameter object.…
Salivan
  • 157
  • 7
1
vote
1 answer

How can we extract covariance matrix from a parsnip object?

I am trying to use tidymodels ecosystem to perform econometric analysis. The example I am following at the moment is from the book “Principles of Econometrics with R” by Colonescu. The data from the book can be downloaded…
Eva
  • 663
  • 5
  • 13
1
vote
0 answers

Fail to tune censored package in tidymodels

Tidymodels is an amazing package! Censored data is very common in medical research. When I was trying to tune the 'boost_tree' model using the 'censored' package, the error comes:' Unknown mode for parsnip model.' Does it seem that 'censored…
Yuan K
  • 31
  • 3
1
vote
2 answers

how does parsnip know how to match `fit` arguments to function arguments for a model?

I am trying to create a new model for the parsnip package from an existing modeling function foo. I have followed the tutorial in building new models in parsnip and followed the README on Github, but I still cannot figure out some things. How does…
cmo
  • 3,762
  • 4
  • 36
  • 64
1
vote
1 answer

get fitted values from tidymodel implementation of glmnet

I am performing elastic net linear regression in tidymodels using the glmnet engine. If I were to run this directly in glmnet I could do something like this: cv_fit <- cv.glmnet( y = response_vec, x = predictor_matrix, …
mbyvcm
  • 141
  • 2
  • 12
1
vote
1 answer

error checking glmnet model from parsnip object using easystats: $ operator is invalid

Tried to check_model using a very simple glmnet classification task. Taken some Code from here: Extract plain model from tidymodel object library(magrittr) library(tidymodels) library(performance) data(two_class_dat) glm_spec <- logistic_reg()…
Forge
  • 1,587
  • 1
  • 15
  • 36
1
vote
1 answer

Using package specific functions with parsnip

I'm trying to learn the R's modeling framework tidymodels. After creating the model and specifying the package (engine) I want to use for my model, I now try to use some specific functions that are inside of the engine I chose. In this case it is…
Ata
  • 27
  • 6
1
2 3