Challenge: Model Selection Workflow
Uppgift
Swipe to start coding
You are working with scikit-learn model selection tools to evaluate and compare models in a consistent way.
- Split the dataset
Xandyinto training and test sets usingtrain_test_splitwith:test_size=0.25;random_state=42.
- Create a
LogisticRegressionestimator withmax_iter=1000. - Evaluate the estimator using
cross_val_scorewithcv=3. - Create a
GridSearchCVobject namedgrid_searchwith:- the estimator;
- the parameter grid
param_grid; cv=3.
- Fit
grid_searchon the training data. - Store:
- the mean cross-validation score in
cv_mean_score; - the best parameter dictionary in
best_params.
- the mean cross-validation score in
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 4. Kapitel 4
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Fantastiskt!
Completion betyg förbättrat till 5.26
Challenge: Model Selection Workflow
Svep för att visa menyn
Uppgift
Swipe to start coding
You are working with scikit-learn model selection tools to evaluate and compare models in a consistent way.
- Split the dataset
Xandyinto training and test sets usingtrain_test_splitwith:test_size=0.25;random_state=42.
- Create a
LogisticRegressionestimator withmax_iter=1000. - Evaluate the estimator using
cross_val_scorewithcv=3. - Create a
GridSearchCVobject namedgrid_searchwith:- the estimator;
- the parameter grid
param_grid; cv=3.
- Fit
grid_searchon the training data. - Store:
- the mean cross-validation score in
cv_mean_score; - the best parameter dictionary in
best_params.
- the mean cross-validation score in
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 4. Kapitel 4
single