Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Model Selection Workflow | Model Selection and Evaluation Utilities
Mastering scikit-learn API and Workflows

bookChallenge: Model Selection Workflow

Oppgave

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.

Løsning

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 4. Kapittel 4
single

single

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

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

Sveip for å vise menyen

Oppgave

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.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 4. Kapittel 4
single

single

some-alt