Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a Python class named ClusteringOperations Code will be saved in Q 2 . py This class will have the following methods: a ) (
Create a Python class named ClusteringOperations
Code will be saved in
Qpy
This class will have the following methods:
a points possible Create a class method named calculatesilhouettescores that gets
as an argument a list of partitions this will be a list of lists of lists each first level sublist
represents a partition, and partition will have multiple lists, each representing one
datapoint As a distance function, use the Euclidean distance.
The method will implement a modified version of the silhouette coefficient score for
each data point, using a modified version of the formulas presented in class.
The modification is for function which will equal to
The method will return a list with scores, each score representing the silhouette score
for one datapoint. The order of the data points will be kept the same as in the input
argument.
For example if let's say our datapoints are D vectors, and the input argument is given
by
In this example we have three partitions: first second
and third
The first partition has two data points and
The second partition has three data points:
and
The third partition has two data points and
For such an input, in the result you would need to return the silhouette score for each of
these seven datapoints, in this order. The datapoints will keep the other they appear in
the input argument.
This means you will return a list with silhouette scores, and the first element will have
the silhouette score for datapoint, the second element will have the silhouette
score for datapoint, and so on
Your method must work with any number of partitions, any number of datapoints, and
datapoints of any dimension.
Note: no method that calculates the silhouette score could be called. This method needs
to be fully implemented by you according to the instructions given. b points possible Create
a class method called invokesilhoutte that gets as an
argument a list of partitions same format as for method calculatesilhouettescores
an it calls calculatesilhouettescores and gets the silhouette score for the datapoints.
It prints that on disk. After that it calculates the mean silhouette score and it returns
that value.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started