Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: Comparing Models | Comparing Models
Classification with Python

Свайпніть щоб показати меню

book
Challenge: Comparing Models

Now you'll compare the models we've covered using a single dataset — the breast cancer dataset. The target variable is the 'diagnosis' column, where 1 represents malignant and 0 represents benign cases.

You will apply GridSearchCV to each model to find the best parameters. In this task, you'll use recall as the scoring metric because minimizing false negatives is crucial. To have GridSearchCV select the best parameters based on recall, set scoring='recall'.

Завдання

Swipe to start coding

You are given a breast cancer dataset stored as a DataFrame in the df variable.

  • Create a dictionary for GridSearchCV to iterate through [3, 5, 7, 12] values for n_neighbors and store it in the knn_params variable.
  • Create a dictionary for GridSearchCV to iterate through [0.1, 1, 10] values for C and store it in the lr_params variable.
  • Create a dictionary for GridSearchCV to iterate through [2, 4, 6, 10] values for max_depth and [1, 2, 4, 7] values for min_samples_leaf, and store it in the dt_params variable.
  • Create a dictionary for GridSearchCV to iterate through [2, 4, 6] values for max_depth and [20, 50, 100] values for n_estimators, and store it in the rf_params variable.
  • Initialize and train a GridSearchCV object for each of the model, and store the trained models in the respective variables: knn_grid, lr_grid, dt_grid, and rf_grid.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 5. Розділ 3

Запитати АІ

expand
ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

book
Challenge: Comparing Models

Now you'll compare the models we've covered using a single dataset — the breast cancer dataset. The target variable is the 'diagnosis' column, where 1 represents malignant and 0 represents benign cases.

You will apply GridSearchCV to each model to find the best parameters. In this task, you'll use recall as the scoring metric because minimizing false negatives is crucial. To have GridSearchCV select the best parameters based on recall, set scoring='recall'.

Завдання

Swipe to start coding

You are given a breast cancer dataset stored as a DataFrame in the df variable.

  • Create a dictionary for GridSearchCV to iterate through [3, 5, 7, 12] values for n_neighbors and store it in the knn_params variable.
  • Create a dictionary for GridSearchCV to iterate through [0.1, 1, 10] values for C and store it in the lr_params variable.
  • Create a dictionary for GridSearchCV to iterate through [2, 4, 6, 10] values for max_depth and [1, 2, 4, 7] values for min_samples_leaf, and store it in the dt_params variable.
  • Create a dictionary for GridSearchCV to iterate through [2, 4, 6] values for max_depth and [20, 50, 100] values for n_estimators, and store it in the rf_params variable.
  • Initialize and train a GridSearchCV object for each of the model, and store the trained models in the respective variables: knn_grid, lr_grid, dt_grid, and rf_grid.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 5. Розділ 3
Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Ми дуже хвилюємося, що щось пішло не так. Що трапилося?
some-alt