Questions tagged [r-recipes]

recipes is an R package by Max Kuhn and Hadley Wickham for creating and preprocessing design matrices.

recipes is an R package by Max Kuhn and Hadley Wickham for creating and preprocessing design matrices.

131 questions
3
votes
1 answer

Can't seem to remove variables in recipes

I'm new to recipes and having some issues with the API. Why can't I bake or juice my recipe steps when I've removed certain features that I'm not interested in? set.seed(999) train_test_split <- initial_split(mtcars) mtcars_train <-…
Zafar
  • 1,897
  • 15
  • 33
2
votes
0 answers

Prevent tidymodels from turning numeric to chr

Apologies if this has been asked before, but I was unable to find the corresponding info. I am using the recipe from tidymodels and trying to create a model (eventually). As I prepped my this is effectively what it looked like (apologies, I can't…
2
votes
2 answers

Error on running `predict()` in tidymodels "Error in `dplyr::select()`: Can't subset columns that don't exist."

Problem I get an error when running predict in the tidymodels framework. The error appears to be related to selecting variables in the recipe (see code below). What I've tried There are some related SO posts, such as this one, this one, or this one,…
Sebastian Sauer
  • 1,555
  • 15
  • 24
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
2
votes
0 answers

How to deal with external regressors in time series recipes?

In time series forecasting external regressors can make a big difference. Currently I want to track the effects of external regressors, using the modeltime framework. However, I could not find any helpful information on this topic so far. I only…
2
votes
1 answer

Tune recipe in workflow set with custom range (or value)

I'm trying to use workflow_set() function in tidymodels to evaluate a batch of models. I've understand that is possible to modify some model specification in order to change the search range so, for example, given this specification: spec_lin <-…
Ilproff_77
  • 207
  • 1
  • 3
  • 17
2
votes
1 answer

Missing data after step_naomit in fit_resamples

I am currently applying the following recipe and workflow in order to fit a Random Forest using 5 folds cross validation using fit_resamples. The workflow looks something like this: library(tidymodels) # import data and convert response to…
anddt
  • 1,589
  • 1
  • 9
  • 26
2
votes
1 answer

step mutate fixed value to a list of variables in tidymodels

I wonder if could be possible to mutate variables inside my recipe taking a list of variables and imputing a fixed value (-12345) when NA is found. No success so far. my_list <- c("impute1", "impute2", "impute3") recipe <- recipes::recipe(target…
Forge
  • 1,587
  • 1
  • 15
  • 36
2
votes
1 answer

How to reduce the size of a preprocessing recipe object in r?

I am preprocessing a dataset with the R recipes packages, doing Yeo-Johnson transformation to make it more normally distributed and then scaling to standardize it. After that I want to reduce the size of the recipe object, I use the butcher package.…
2
votes
1 answer

How to tune a tidymodels recipe parameter?

Description I am trying to tune a custom parameter in a recipe but I am having trouble to do so. I was under the impression that this is only a matter of calling tune("variableID") in the recipe and then use tune_grid() with a grid that contains a…
AlbertRapp
  • 408
  • 2
  • 9
2
votes
1 answer

Tidymodels Workflow working with add_formula() or add_variables() but not with add_recipe()

I encountered some weird behavior using a recipe and a workflow to descriminate spam from valid texts using a naiveBayes classifier. I was trying to replicate using tidymodels and a workflow the results the 4th chapter of the book Machine learning…
Alix TC
  • 57
  • 6
2
votes
1 answer

In R recipe with condition to update roles does not work

If variable_names contains names I want to update the role of those to become Not_predictors; whereas if variable_names is NA I want to skip this step within a function. However, when adding the condition I get and error. Please see repex code…
Oscar Kjell
  • 1,599
  • 10
  • 32
2
votes
1 answer

Selecting only ordered factors in recipes for tidymodels

I need to create a recipe using the recipes package from tidymodels. In one of the steps, I need to convert ordered factors to their ordinal score. But there seems to be no function that I can use in order to select all ordered factors. I know that…
tikysal
  • 21
  • 1
2
votes
1 answer

tidymodels metric_set:Error: All inputs to `metric_set()` must be functions. These inputs are not: (2)

I have used recipe()function in tidymodels packages for imputation missing values and fixing imbalanced data. here is my data; mer_df <- mer2 %>% filter(!is.na(laststagestatus2)) %>% select(Id, Age_Range__c, Gender__c, numberoflead,…
Ozgur Alptekın
  • 505
  • 6
  • 19
2
votes
0 answers

Tidypredict does not incorporate Recipes

I fit a model with logistic regression by tidymodels. The function tidypredict_fit extract the formula but I note that it does not incorporate the preprocess in the recipes. How can I extract the model formula with the necessary preprocess? …
1
2
3
8 9