Question: In this assignment, you will use Python's sklearn.cluster package and three of its tools called KMeans, DBSCAN, and AgglomerativeClustering to apply three main clustering methods
In this assignment, you will use Python's sklearn.cluster package and three of its tools called "KMeans", "DBSCAN", and "AgglomerativeClustering" to apply three main clustering methods kmeans, densitybased, and hierarchical methods on different toy datasets of Python SKLearn see here for more detail You can watch the video illustrating some of the Python tools that you need for this assignment:
Part : kmeans clustering points:
Load breast cancer dataset by calling sklearn.datasets.loadbreastcancer
data loadbreastcancerdata
Since the dataset has different features, use the following code to reduce the dimensions of the dataset to features as we will later plot the observations using D scatter plots, this is a necessary step!:
from sklearn.decomposition import PCA
pca PCA
df pca.fittransformdata
Create an object of sklearn.cluster.KMeans class with nclusters
kmeans KMeansnclusters
Fit and predict the transformed dataset df:
label kmeans.fitpredictdf
Use matplotlib.pyplot to plot all the observations on a D coordinate system. Color observations of each cluster with a different color:
import matplotlib.pyplot as plt
for i in range:
pltscatterdf label label i
pltlegend
pltshow
Part points: Repeat Part I for digits dataset use loaddigits instead Use densitybased clustering use DBSCANminsamples eps instead of clusters : Draw the plot for labels
Part points: Repeat Part I for iris dataset use loadiris instead Use hierarchical clustering with clusters use AgglomerativeClusteringnclusters instead of KMeansnclusters
Part points Repeat Parts and for nclusters and digits dataset.
Deliverables
Submit a zip file containing your Python code and a "report.pdf depicting all the plots drawn in the four parts and a paragraph comparing the three methods under different circumstances.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
