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
1
vote
1 answer

How does the tune package handles the mtry hyperparameter when applying step_dummy

I'm defining the grid for a xgboost model with grid_latin_hypercube(). I understand that the mtry hyperparameter should be finalized either with the finalize() function or manually with the range parameter of mtry(). Assuming that I have a dataframe…
dzegpi
  • 554
  • 5
  • 14
1
vote
2 answers

step_pca() arguments are not being applied

I'm new to tidymodels but apparently the step_pca() arguments such as nom_comp or threshold are not being implemented when being trained. as in example below, I'm still getting 4 component despite setting nom_comp =…
1
vote
1 answer

Preprocessing data with R `recipes` package: how to impute by mode in numeric columns (to fit model with xgboost)?

I want to use xgboost for a classification problem, and two predictors (out of several) are binary columns that also happen to have some missing values. Before fitting a model with xgboost, I want to replace those missing values by imputing the mode…
Emman
  • 3,695
  • 2
  • 20
  • 44
1
vote
2 answers

How to translate `recipes::step_dummy()` to `dplyr`/`tidyr` code?

I'm trying to figure out how step_dummy() from recipes package wrangles the data. Although there's a reference page for this function, I'm still unable to wrap my head around how to do it using "regular" tidyverse tools I know. Here's some code…
Emman
  • 3,695
  • 2
  • 20
  • 44
1
vote
1 answer

Is there a way to specify the reference variable when using `recipes::step_dummy()`?

Is there a way to specify the reference level when creating dummy variables with step_dummy()? I can do so by setting one_hot = TRUE then removing the reference column, but wondering if it's possible to specify within step_dummy()…
Mark Rieke
  • 306
  • 3
  • 13
1
vote
2 answers

step_mutate with textrecipes tokenlists

I'm doing NLP with the tidymodels framework, taking advantage of the textrecipes package, which has recipe steps for text preprocessing. Here, step_tokenize takes a character vector as input and returns a tokenlist object. Now, I want to perform…
dzegpi
  • 554
  • 5
  • 14
1
vote
1 answer

How do i add blueprint into workflow_set in tidymodels

I tried to follow the examples in the Link 1 - Sparse Matrix https://www.tidyverse.org/blog/2020/11/tidymodels-sparse-support/ Link 2 - Workflow_sets https://www.tmwr.org/workflow-sets.html I had trouble including the blue print into the workflow…
Choc_waffles
  • 518
  • 1
  • 4
  • 15
1
vote
1 answer

no applicable method for 'prep' applied to an object of class

I am building a custom recipes function and getting an error when I try to prep() the recipe. I get the following error: > prep(rec_obj) Error in UseMethod("prep") : no applicable method for 'prep' applied to an object of class…
MCP_infiltrator
  • 3,961
  • 10
  • 45
  • 82
1
vote
1 answer

Create Recipes and passing column names dynamically

I have a function that simply creates a couple of recipe objects. The issue is that inside of the function I have to rename the columns of the data.frame/tibble passed so that I can make the recipes. I don't want to do this for obvious reasons, the…
MCP_infiltrator
  • 3,961
  • 10
  • 45
  • 82
1
vote
0 answers

I got NAs error when applying lasso model to the recipe

I was trying to apply a lasso model to a recipe I created (using recipes package) but I am getting the error: NAs introduced by coercion Error in lognet(xd, is.sparse, ix, jx, y, weights, offset, alpha, nobs, : NA/NaN/Inf in foreign function…
V.Sun
  • 11
  • 2
1
vote
0 answers

How to interpret the warnings: "No tuning parameters" and "All models failed" in Tidymodels workflowsets

I am running into some warnings and errors when trying to run (tune) my workflowsets with the workflowsets package from tidymodels: i No tuning parameters. `fit_resamples()` will be attempted i 1 of 30 resampling: normalized_lm ✓ 1 of 30…
1
vote
1 answer

R - Partial dependence plots from workflow

I created the following recipe to predict my random forest in R: set.seed(123456) cv_folds <- Data_train %>% vfold_cv(v = 4, strata = Lead_week) # Create a recipe rf_mod_recipe <- recipe(Lead_week ~ Jaar + Aantal + Verzekering + Leeftijd + Retentie…
Kylian
  • 319
  • 2
  • 14
1
vote
1 answer

Error: Can't subset columns that don't exist when running prediction using {Tidymodels}

I'm trying to predict real estate prices in R with Tidymodels. I'm following this tutorial. All goes well until the very and when I try to run prediction on my test data. Please see the below code example and the error at the very end. I looked at…
PeterAL
  • 67
  • 7
1
vote
1 answer

Elegant way to invert tranform recipes steps (normalize and log)?

What is the most elegant way to transform back outcome (in this case it's mpg) column that was transformed by recipes? The solution can be general (if exists or only for log and normalize steps (as coded below). Links that might be useful: The…
mihagazvoda
  • 1,057
  • 13
  • 23
1
vote
1 answer

recipes package cannot create interaction term in step_interact

I'm using a medical insurance data set to hone my modeling skills that looks like this: > insur_dt age sex bmi children smoker region charges 1: 19 female 27.900 0 yes southwest 16884.924 2: 18 male 33.770 …
CelineDion
  • 906
  • 5
  • 21
1 2 3
8 9