Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Feature Engineering Techniques | Section
Predictive Modeling with Tidymodels in R

bookFeature Engineering Techniques

Glissez pour afficher le menu

Feature engineering is a crucial step in predictive modeling, allowing you to extract more information from your data and improve model performance. Common techniques include creating polynomial features, which involve raising predictors to a power to capture non-linear relationships, and generating interaction terms, which multiply two or more variables to model their combined effects. These transformations help models detect more complex patterns that linear terms alone might miss.

1234567891011121314151617
library(recipes) library(tibble) options(crayon.enabled = FALSE) data <- tibble( x1 = c(1, 2, 3, 4, 5), x2 = c(5, 4, 3, 2, 1), y = c(2, 3, 5, 7, 11) ) rec <- recipe(y ~ x1 + x2, data = data) %>% step_poly(x1, degree = 2, keep_original_cols = TRUE) %>% step_interact(terms = ~ x1:x2) rec_prep <- prep(rec, training = data) transformed_data <- bake(rec_prep, new_data = data) print(transformed_data)
copy

You should use feature engineering when your initial predictors may not fully capture the complexity of the relationship between features and the target variable. Polynomial features can help when you suspect non-linear effects, while interaction terms are valuable if the effect of one variable depends on another. However, adding too many features can lead to overfitting, so always consider the context of your modeling problem and validate the impact of new features through cross-validation or resampling.

question mark

Which feature engineering step would be most appropriate if you believe the effect of one predictor on the outcome depends on another predictor?

Sélectionnez la réponse correcte

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 3

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

Section 1. Chapitre 3
some-alt