Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 4 Model hyperparameter tuning [ 2 5 marks ] ( a ) Write code to train a random forest classifier for the scikit -

Question 4 Model hyperparameter tuning [25 marks]
(a) Write code to train a random forest classifier for the scikit-learns breast cancer dataset (see the load_breast_cancer() function). Use the default (hyper)parameters of the classifier, apply 10-fold cross-validation, find and display the test score of the model. [5]
(b) Write code to display the hyperparameters of the random forest classifier model. [3]
(c) Write code to perform a randomized search to find the potentially best hyperparameters of applying the random forest model to the breast cancer dataset. Search in 50 random samples of parameter settings. Use the search parameter settings below, and output the best model instance, score, and parameter values.
[13]
the number of trees: integer range from 10 to 1000 in increments of 10
the number of features to consider when looking for the best split: integer range from 1 to the number of features of the breast cancer data
the maximum depth of the tree: integer range from 1 to 20
(d) Refer to the documentation of scikit-learn and answer the following questions. [4]
(i) In the sklearn.model_selection module, beside GridSearchCV and RandomizedSearchCV, there are two other classes that search for optimized hyperparameters. What are the two classes?
(ii) Briefly describe the search strategy of the two classes.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Icdt 88 2nd International Conference On Database Theory Bruges Belgium August 31 September 2 1988 Proceedings Lncs 326

Authors: Marc Gyssens ,Jan Paredaens ,Dirk Van Gucht

1st Edition

3540501711, 978-3540501718

More Books

Students also viewed these Databases questions

Question

Consider function f(x) =cos(3x) on the interval 1

Answered: 1 week ago