Write and test a code on MATLAB to form 'k' clusters of given 'N' data points,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write and test a code on MATLAB to form 'k' clusters of given 'N' data points, where each data point is of 'd' dimensions. The code should follow the given steps: a) Open a text file "input.txt" and read data from it. Each data point in one line with comma separated entries. The number of entries in each line tells you the dimension of the data. b) Take the input of number of clusters 'k' from the user c) Initialize centroids by first shuffling the dataset and randomly selecting 'k' data points for the centroids without replacement. d) Keep iterating until the change in centroids is less than a threshold 'e'. i. Compute the sum of the squared distance between data points and all centroids ii. Assign each data point to the closest centroid i. Compute the centroids for the clusters by taking the average of all the data points that belong to one cluster. e) Write a text file "output.txt" containing the location of 'k' centroids Grad-+g Scheme: Problem 1: Opening and reading text file: "input.txt" Displaying an error message when the file does not exist [1 point] Loading the data points Taking the input of number of clusters 'k' from the user Random initialization of the centroids Estimation of the squared distance of each data point Assignment of data point to cluster centroid Updated estimation of centroids from new clusters Writing the text file "output.txt" [50 points] [2 points] [5 points] [2 points] [5 points] [15 points] [5 points] [10 points] [5 points] Write and test a code on MATLAB to form 'k' clusters of given 'N' data points, where each data point is of 'd' dimensions. The code should follow the given steps: a) Open a text file "input.txt" and read data from it. Each data point in one line with comma separated entries. The number of entries in each line tells you the dimension of the data. b) Take the input of number of clusters 'k' from the user c) Initialize centroids by first shuffling the dataset and randomly selecting 'k' data points for the centroids without replacement. d) Keep iterating until the change in centroids is less than a threshold 'e'. i. Compute the sum of the squared distance between data points and all centroids ii. Assign each data point to the closest centroid i. Compute the centroids for the clusters by taking the average of all the data points that belong to one cluster. e) Write a text file "output.txt" containing the location of 'k' centroids Grad-+g Scheme: Problem 1: Opening and reading text file: "input.txt" Displaying an error message when the file does not exist [1 point] Loading the data points Taking the input of number of clusters 'k' from the user Random initialization of the centroids Estimation of the squared distance of each data point Assignment of data point to cluster centroid Updated estimation of centroids from new clusters Writing the text file "output.txt" [50 points] [2 points] [5 points] [2 points] [5 points] [15 points] [5 points] [10 points] [5 points]
Expert Answer:
Answer rating: 100% (QA)
function clusters clusterCenters kMeansClusteringdataSetnumClustersnumIterations Simple implementati... View the full answer
Related Book For
Computer Organization and Design The Hardware Software Interface
ISBN: 978-0124077263
5th edition
Authors: David A. Patterson, John L. Hennessy
Posted Date:
Students also viewed these computer network questions
-
Assume you need to write and test a client-server application program on two hosts you have at home. a. What is the range of port numbers you would choose for the client program? b. What is the range...
-
Using Python, write and test a function called min_max_avg. This function should accept any number of float arguments and return a tuple of the min, max, and average (mean) of the list of numbers...
-
Write and test a MIPS assembly language program to compute and print the first 100 prime numbers. A number n is prime if no numbers except 1 and n divide it evenly. You should implement two routines:...
-
Evaluate 3x - 1 / x - 1. lim
-
The US Imports Company purchased 100,000 Freedonian marks' worth of machinery from a firm in Zeppo, Freedonia. The value of the dollar in terms of the mark has been decreasing. The firm in Zeppo...
-
Jules Bianchi is a bond analyst for Maneval Investments, Inc. Bianchi gathers data on three corporate bonds, as shown in Exhibit 1. To assess the interest rate risk of the three bonds, Bianchi...
-
In a study of birth order and intelligence, IQ tests were given to 18- and 19-year-old men to estimate the size of the difference, if any, between the mean IQs of firstborn sons and secondborn sons....
-
A statistics practitioner wants to test the following hypotheses with = 20 and n = 100: H0: = 100 H1: > 100 a. Using = .10 find the probability of a Type II error when = 102. b. Repeat part (a)...
-
Question 3 Maju Holdings Sdn Bhd ("MHSB") was established on 1 February 2020 as a firm specializing in investment holdings. The company has two initial investors, Mr. A and Mr. B. Both contributed an...
-
1. Which process should VBB choose to produce?? 2. How much would VBP be willing to pay for the testing that is currently offered, for each batch?? 3. Would we be considered a perfect test, at twice...
-
Here is the budget and results for 20X1 of the Robbin lte company. Results (26000 boxes) Budget initial (22000botes) Sales 1812200$ 1540000$ Matires premieres 315120$ 264000$ Direct labor 518700$...
-
Which of the following is least likely to be an example of ordinary negligence? a. The auditor misinterprets a transaction because he or she did not read the invoice carefully. b. The auditor reads...
-
Which of the following is an example of a privity relationship? a. A third party for whom the audit is being primarily conducted is known by the auditor. b. A third party unknown specifically by the...
-
Which of the following is more likely to be a foreseen party? a. The president of the auditor's client. b. A local bank that might be expected to lend the client money relying, in part, on the...
-
Which of the following is most likely to be an example of fraud? a. The auditor fails to properly determine the reason why so many of the client's customers complain that they have been overcharged....
-
Consider $\mathbb{R}^{2}$ equipped with the discrete metric $$d(x, y)= \begin{cases}1 & \text { if } x eq y \\ 0 & \text { if } x=y\end{cases}$$ where $x$ and $y$ are elements of $\mathbb{R}^{2}$,...
-
an employee working in quebec receive salry of $1500 bi weekly and a cash allowance of $100 per pay how much will he pay on quebec parental insurnce plan premium assuming the employee will not reach...
-
If M = 7, s = 2, and X = 9.5, what is z?
-
Assume 151 and 214 are unsigned 8-bit integers. Calculate 151 + 214 using saturating arithmetic. The result should be written in decimal. Show your work.
-
Write the MIPS assembly code to implement the following C code: lock(lk); shvar=max(shvar,x); unlock(lk); Assume that the address of the lk variable is in $a0, the address of the shvar variable is in...
-
Consider three diff erent processors P1, P2, and P3 executing the same instruction set. P1 has a 3 GHz clock rate and a CPI of 1.5. P2 has a 2.5 GHz clock rate and a CPI of 1.0. P3 has a 4.0 GHz...
-
Name eight documents or records that would be examined in the review of subsequent events. For what period would the review be conducted?
-
List eleven matters that would be discussed with management in connection with the audit of subsequent events.
-
What are the purposes of management representations?
Study smarter with the SolutionInn App