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
-
Do the following functions exhibit increasing, constant, or decreasing returns to scale? What happens to the marginal product of each individual factor as that factor is increased and the other...
-
Describe the distribution tasks that retailers are especially well suited for performing.
-
This practice problem uses the data contained in the file named. There are two variables in this data set. Using Excel, compute the standard deviation and variance (both biased and unbiased) for...
-
The cash account for Fit Bike Co. at August 1, 2014, indicated a balance of $12,190. During August, the total cash deposited was $28,100 and checks written totaled $33,010. The bank statement...
-
In what ways is the "Ohio State" model of leadership different from the "Trait Theory" of leadership? Explain, and be specific. In what ways is the "Ohio State" model of leadership different from the...
-
Cell Therapy, Inc. has a cost of capital of 9%, and it has a project with the following cash flows. What is the NPV of this project? Year Net Cash Flow Cell Therapy, Inc. Cash Flows 0 -100,000 1...
-
Describe the major components and mode of operation of CSMA/CD bus network.
-
A semi-annual coupon bond with 10 years to maturity and 10% annual coupon rate. The annual market required interest rate is 8%. Assume the bond's face value is $1000. Based on semiannual compounding,...
-
Pete Peters read the following partial advertisement: Price $20,900; down payment $1,000; $390.85 per month for 60 months. 1) What is the amount financed? 2) What is the total finance charge?
-
A 5%, 10-year bond has a yield to maturity of 3.75% and modified duration of 6.2 years. If the market is expected to increase by 125 basis points, what do you estimate will be the percent change...
-
Let h(x) = x + 5 and g(x) = x-8. Find (h-g)(-2).
-
Discuss self-understanding in middle childhood by providing a detailed example of the development of self-concept and a detailed example of the development of self-esteem in this stage. Information...
-
You want to buy life insurance. List and explain/describe three different options you have for the purchase (marketing systems), e.g. affiliated agent, direct response, etc. Which would you choose?...
-
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...
-
One of the models used for predicting the severity of head injury is shown in Fig. 5.68 where \(f(t)\) denotes the force of blow to the head, \(m_{1}\) is the mass of that part of the head which lies...
-
Write the equations of motion of a multidegree-of-freedom system in matrix form using a. the flexibility matrix, and b. the stiffness matrix.
-
What is a generalized mass matrix?
Study smarter with the SolutionInn App