- Subject Code :
COMP542
- Country :
United States America
Connect with COMP542 Expert Now
Assignment Task
1. K-Mean++. Implement K-Mean++ clustering algorithm in python as follows:
– Read input file ‘as4_1.txt’ given in the Canvas course website. The file is composed of X and Y values in the first and second columns and label in the third column.
– Create myInit() that places the initial k centroids far away from each other in the
4 steps as shown below:
1. Randomly select the first centroid from the data points
2. For each data point compute its distance from the nearest, previously chosen centroid
Use following Euclidean distance function: import numpy as np def euclidean2D(point1, point2):
x1 = point1[0]
x2 = point2[0]
y1 = point1[1]
y2 = point2[1] return np.sqrt((x1 – x2)**2 + (y1 – y2)**2)
3. Select the point having maximum distance from the nearest centroid as the next centroid
4. Repeat steps 2 and 3 until k centroids have been sampled
– Create myAssign() that assigns each example to the nearest centroid
– Create myCentroid() that calculates a new centroid of all points that are assigned to the same centroid.
– Create myUpdateCentroid() that moves the centroids to the center of the examples that were assigned to it
– Create myKmeanPlusPlus() that initially calls myInit(), and then repeats to call myAssign(), myCentroid(), and myUpdateCentroids() until the cluster assignments do not change or a user-defined tolerance or maximum number of iteration is reached. myKmeanPlusPlus() should ask user to receive the following arguments and use the same variable name in the parenthesis:
1. The number of clusters (k)
2. Tolerance (myTol)
3. Maximum number of iterations (myMax) myKmeanPlusPlus()returns a list of new labels.
– Create myPlot() that visualizes plot of clustering result in different colors and markers. You can use any plot method.
This COMP542 – IT Assignment has been solved by our IT experts at Schooling Best. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.
Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.
-
Uploaded By : Brett
-
Posted on : December 20th, 2019
-
Downloads : 0
Order New Solution
Can’t find what you’re looking for?
This Christmas, The Most Magical Time of The Year, save up to 65% on Our one-to-one Academic Assistance.
Grab Now