Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Feature Engineering Techniques | Section
Практика
Проекти
Вікторини та виклики
Вікторини
Виклики
/
Predictive Modeling with Tidymodels in R

bookFeature Engineering Techniques

Свайпніть щоб показати меню

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?

Виберіть правильну відповідь

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 3

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

Секція 1. Розділ 3
some-alt