Question: ( b ) In this part, we do an experiment to explore the use of clustering for making predictions. [ 1 1 ] ( i

(b) In this part, we do an experiment to explore the use of clustering for making predictions. [11]
(i) Write code to apply k-means to cluster the scikit-learns breast cancer dataset (see the load_breast_cancer() function) to 2 clusters, using only the features but not the target. Also write code to, for each of the resulting clusters, count the data points (i.e. instances) with target value 0, and those with target value 1; display the counts.
(ii) Notice that if the clusters have different majority target classes, the clustering scheme may be used for predicting a data point as the majority target class of the cluster that data point belongs to. Compute the accuracy using the total count of the majority target classes and the total number of data points.
(c) Repeat part (b) using agglomerative hierarchical clustering instead of k-means clustering.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!