Challenge: Feature Selection Pipeline
Tehtävä
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:
- Load the dataset using
load_diabetes(). - Split it into train/test sets (
test_size=0.3,random_state=42). - Build a pipeline with:
StandardScaler().SelectFromModel(Lasso(alpha=0.01, random_state=42))for automatic feature selection.LinearRegression()as the final model.
- Fit the pipeline and evaluate it using R² score on the test set.
- Print:
- The R² score (rounded to 3 decimals).
- The number of features selected.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 2. Luku 4
single
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme
Awesome!
Completion rate improved to 8.33
Challenge: Feature Selection Pipeline
Pyyhkäise näyttääksesi valikon
Tehtävä
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:
- Load the dataset using
load_diabetes(). - Split it into train/test sets (
test_size=0.3,random_state=42). - Build a pipeline with:
StandardScaler().SelectFromModel(Lasso(alpha=0.01, random_state=42))for automatic feature selection.LinearRegression()as the final model.
- Fit the pipeline and evaluate it using R² score on the test set.
- Print:
- The R² score (rounded to 3 decimals).
- The number of features selected.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 2. Luku 4
single