Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Challenge: Model Selection Workflow | Model Selection and Evaluation Utilities
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Mastering scikit-learn API and Workflows

bookChallenge: Model Selection Workflow

Tâche

Swipe to start coding

You are working with scikit-learn model selection tools to evaluate and compare models in a consistent way.

  1. Split the dataset X and y into training and test sets using train_test_split with:
    • test_size=0.25;
    • random_state=42.
  2. Create a LogisticRegression estimator with max_iter=1000.
  3. Evaluate the estimator using cross_val_score with cv=3.
  4. Create a GridSearchCV object named grid_search with:
    • the estimator;
    • the parameter grid param_grid;
    • cv=3.
  5. Fit grid_search on the training data.
  6. Store:
    • the mean cross-validation score in cv_mean_score;
    • the best parameter dictionary in best_params.

Solution

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 4. Chapitre 4
single

single

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

Suggested prompts:

Can you explain this in simpler terms?

What are the main benefits or drawbacks?

Can you give me a real-world example?

close

bookChallenge: Model Selection Workflow

Glissez pour afficher le menu

Tâche

Swipe to start coding

You are working with scikit-learn model selection tools to evaluate and compare models in a consistent way.

  1. Split the dataset X and y into training and test sets using train_test_split with:
    • test_size=0.25;
    • random_state=42.
  2. Create a LogisticRegression estimator with max_iter=1000.
  3. Evaluate the estimator using cross_val_score with cv=3.
  4. Create a GridSearchCV object named grid_search with:
    • the estimator;
    • the parameter grid param_grid;
    • cv=3.
  5. Fit grid_search on the training data.
  6. Store:
    • the mean cross-validation score in cv_mean_score;
    • the best parameter dictionary in best_params.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 4. Chapitre 4
single

single

some-alt