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
0
votes
0 answers

Getting error when trying to apply tidymodels recipe from train data to resamples in r?

I am new to tidymodels and somewhat new in R as well. I am trying to replicate code of David Robinson from Youtube tidytuesday/Sliced Customer churn data but facing issues in applying recipe changes on cross validated data / resamples. Issue: When I…
ViSa
  • 1,563
  • 8
  • 30
0
votes
1 answer

Error: The first argument to [fit_resamples()] should be either a model or workflow

Problem: I'm following a tutorial from Julia Silge (link here) on using tidymodels and recipes. I can get most of the way through without a problem but when I come to calling the fit_resamples() function I get the error: Error: The first argument to…
C.Robin
  • 1,085
  • 1
  • 10
  • 23
0
votes
1 answer

passing a list of variables to recipe in tidymodels causes model error

I have a simple recipe to train a model. My categorical variables are changing over time and sometimes I want a numerical to be treated as categorical (postal code) , so I define a list prior to recipe containing them. (just for the sake of the…
Forge
  • 1,587
  • 1
  • 15
  • 36
0
votes
1 answer

Tidymodels: Impute missing values in a Date column?

this question is a duplicate of Tidymodels: What is the correct way to impute missing values in a Date column? As the question was closed I provided a reprex and raise the question again. I struggle a bit with missing values in a Date column. In my…
Mischa
  • 137
  • 8
0
votes
1 answer

Tidymodels: What is the correct way to impute missing values in a Date column?

I struggle a bit with missing values in a Date column. In my pre-processing pipeline (recipe-object) I used the step_impute_knn function to fill missing values in all my Date columns. Unfortunately I got the following error: Assigned data pred_vals…
Mischa
  • 137
  • 8
0
votes
1 answer

Error / Warning "There are new levels in a factor: NA"

I am working on creating a Random Forest model using the tidymodels approach. In the recipe function, I get this error/warning that I simply cannot interpret, but it must be something related to the summary variables created. The error is There are…
0
votes
0 answers

step_BoxCox() with negative data

My understanding is that the step_BoxCox() requires a strictly positive variable. However, I tried to apply the step on data that has some negative values, I didn't get an error or a warning. The output had no NA values. I don't know what is wrong,…
hnagaty
  • 796
  • 5
  • 13
0
votes
1 answer

recipes::step_num2factor() leaves last level as NA when baking despite enough levels supplied (MWE supplied)

The last category I create with the function step_num2factor() creates all levels correctly but the last one. There it fills in an NA. MWE test <- tibble(pred = c(0, 1, 2, 3, 4, 5, 8), target = c(0,1,0,1,1,1,0)) looks like this when printed: # A…
thebilly
  • 47
  • 5
0
votes
0 answers

SMOTE within a recipe versus SMOTE in trainControl

I am trying to understand where exactly SMOTE-ing should occur when training a model with cross-validation. I understand that all pre-processing steps should occur for each fold of cross-validation. So does that mean the following two set ups are…
0
votes
1 answer

R tidymodels recipes near zero variance filter for numeric attributes

I have troubles to use the step_nzv in R tidymodels recipes to filter out numeric attributes with small variances but continuous values. To me it seems, that the step applies only for nominal values, as it calculates the number of unique values and…
Lukas
  • 1
0
votes
1 answer

In R selecting X first PCAs components in recipe in tidymodels

I would like to select the X first number of PCA components after they've been computed within a recipe. I then want to add this recipe in a workflow. Please see example data below. library(tidymodels) x1 <- c(1, 6, 4, 2, 3, 4, 5, 7, 8, 2) x2 <-…
John
  • 309
  • 3
  • 12
0
votes
1 answer

In R, error in workflow fit when including step_pca in recipe

In tidymodels I want to create a workflow based on a recipe and a model specification. It works when I do NOT include step_pca(); but when I include step_pca() as a setting I get error. Please see repex blow. (It works fins if I do not use the…
John
  • 309
  • 3
  • 12
0
votes
0 answers

Warning message: All models failed in [fit_resamples()]. See the `.notes` column

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
0
votes
1 answer

tidymodels bake:Error: Please pass a data set to `new_data`

I'm using 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, leadduration,…
Ozgur Alptekın
  • 505
  • 6
  • 19
0
votes
0 answers

Tidymodels error with fit. Error: `x` and `y` must have same types and lengths

I have the following code: library(tidymodels) library(tidyverse) rps <- tribble( ~estado, ~comp_move, ~move, "gana", "piedra", "papel", "pierde", "papel", "piedra", "pierde", "papel",…
1 2 3
8
9