Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: Feature Selection Pipeline | Feature Selection Strategies
Feature Selection and Regularization Techniques

bookChallenge: Feature Selection Pipeline

Завдання

Swipe to start coding

You will build a feature selection + regression pipeline to predict disease progression using the Diabetes dataset. Your goal is to combine preprocessing, feature selection, and model training in one efficient workflow.

Follow these steps:

  1. Load the dataset using load_diabetes().
  2. Split it into train/test sets (test_size=0.3, random_state=42).
  3. Build a pipeline with:
    • StandardScaler().
    • SelectFromModel(Lasso(alpha=0.01, random_state=42)) for automatic feature selection.
    • LinearRegression() as the final model.
  4. Fit the pipeline and evaluate it using R² score on the test set.
  5. Print:
    • The R² score (rounded to 3 decimals).
    • The number of features selected.

Рішення

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

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

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

Секція 2. Розділ 4
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

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

close

Awesome!

Completion rate improved to 8.33

bookChallenge: Feature Selection Pipeline

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

Завдання

Swipe to start coding

You will build a feature selection + regression pipeline to predict disease progression using the Diabetes dataset. Your goal is to combine preprocessing, feature selection, and model training in one efficient workflow.

Follow these steps:

  1. Load the dataset using load_diabetes().
  2. Split it into train/test sets (test_size=0.3, random_state=42).
  3. Build a pipeline with:
    • StandardScaler().
    • SelectFromModel(Lasso(alpha=0.01, random_state=42)) for automatic feature selection.
    • LinearRegression() as the final model.
  4. Fit the pipeline and evaluate it using R² score on the test set.
  5. Print:
    • The R² score (rounded to 3 decimals).
    • The number of features selected.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

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

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

Секція 2. Розділ 4
single

single

some-alt