Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Challenge: Compose a Data Pipeline | Pipelines and Composition Patterns
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Mastering scikit-learn API and Workflows

bookChallenge: Compose a Data Pipeline

Compito

Swipe to start coding

You are building a scikit-learn data pipeline that keeps preprocessing and modeling in a single reusable object.

  1. Create a ColumnTransformer named preprocessor:
    • For numeric columns, use SimpleImputer(strategy="mean");
    • For categorical columns, use OneHotEncoder(sparse_output=False, handle_unknown="ignore").
  2. Create a Pipeline named pipeline with two steps:
    • "preprocessor": the preprocessor;
    • "model": a LogisticRegression estimator with random_state=42.
  3. Fit pipeline using X_train and y_train.
  4. Predict labels for X_test and store them in y_pred.

Soluzione

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 3. Capitolo 4
single

single

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

close

bookChallenge: Compose a Data Pipeline

Scorri per mostrare il menu

Compito

Swipe to start coding

You are building a scikit-learn data pipeline that keeps preprocessing and modeling in a single reusable object.

  1. Create a ColumnTransformer named preprocessor:
    • For numeric columns, use SimpleImputer(strategy="mean");
    • For categorical columns, use OneHotEncoder(sparse_output=False, handle_unknown="ignore").
  2. Create a Pipeline named pipeline with two steps:
    • "preprocessor": the preprocessor;
    • "model": a LogisticRegression estimator with random_state=42.
  3. Fit pipeline using X_train and y_train.
  4. Predict labels for X_test and store them in y_pred.

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 3. Capitolo 4
single

single

some-alt