Using python, implement your own version of the k-means algorithm using both mean and median. (We...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Using python, implement your own version of the k-means algorithm using both mean and median. (We will focus on K-Medoids next week.) Create your implementation that takes: a dataset x, a list of center points c (each of n-dimension) and a enum type that indicates if you are using mean or median. (You can try to pass a function but you will have other dependent code that is based on whether you using the mean or median.) For the sample data set use euclidean distance and do not terminate your algorithm until none of the center points have changed. Use the following data: x = [[1, 2], [2, 1], [1, 3], [5, 4], [6, 3], [7, 2], [6, 1]] Q1: k-means, use center points: c = [[2, 2], [3, 4], [6, 21] Q2: k-means, use center points: c = [[3, 3], [4,1]] Q3: k-medians, use center points: c = [[2, 2], [3, 4], [6, 211 For each problem show the iterations, calculating the new center points (2-dimensional center points). Output the list of cluster values that each datapoint in x was assigned. (Cluster #'s should start at 0.) Using python, implement your own version of the k-means algorithm using both mean and median. (We will focus on K-Medoids next week.) Create your implementation that takes: a dataset x, a list of center points c (each of n-dimension) and a enum type that indicates if you are using mean or median. (You can try to pass a function but you will have other dependent code that is based on whether you using the mean or median.) For the sample data set use euclidean distance and do not terminate your algorithm until none of the center points have changed. Use the following data: x = [[1, 2], [2, 1], [1, 3], [5, 4], [6, 3], [7, 2], [6, 1]] Q1: k-means, use center points: c = [[2, 2], [3, 4], [6, 21] Q2: k-means, use center points: c = [[3, 3], [4,1]] Q3: k-medians, use center points: c = [[2, 2], [3, 4], [6, 211 For each problem show the iterations, calculating the new center points (2-dimensional center points). Output the list of cluster values that each datapoint in x was assigned. (Cluster #'s should start at 0.)
Expert Answer:
Answer rating: 100% (QA)
Implementing the KMeans algorithm using both mean and median in Python involves several steps Below ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Croce, Incorporated, is investigating an investment in equipment that would have a useful life of 1 2 years. The company uses a discount rate of 1 7 % in its capital budgeting. The net present value...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-6. On December 12, Irene purchased the building where her store is located. She paid...
-
Carol Harris, Ph.D, CPA, is a single taxpayer and she lives at 674 Yankee Street, Durham, NC 27409. Her Social Security number is 793-52-4335. Carol is an Associate Professor of Accounting at a local...
-
A clinical study is established to determine if the results of a screening stress test can be used as a predictor of the presence of heart disease. The study enrolls 100 participants who undergo a...
-
The makers of Country Boy Corn Flakes are thinking about changing the packaging of the cereal in the hope of improving sales. In an experiment, ve stores of similar size in the same region sold...
-
Neutrinos are very low mass, extremely weakly interacting particles that permeate the universe. About a quadrillion will pass through you while you read this problem. There are multiple types, or...
-
A sales invoice prepared by the seller is called a purchase invoice by the buyer. True/False
-
The management of Tinker Inc. asks your help in determining the comparative effects of the FIFO and LIFO inventory cost flow methods. For 2014, the accounting records show these data. Inventory,...
-
. Carver Incorporated purchased a building and the land on which the building is situated for a total cost of $823,000 cash. The land was appraised at $179,826 and the building at $766,624....
-
A committee in charge of promoting a Ladies Professional Golf Association tournament is trying to determine how best to advertise the event during the two weeks prior to the tournament. The committee...
-
Please answer Describe and discuss three data sources of your choice regarding the following aspects: (what you use in your personal life, or work or some sources on the internet) What is the name of...
-
What problems arise when cryptography is used as a control in a shared database environment? How can these problems be overcome, at least to some extent, using a hierarchy of cryptographic keys?
-
Describe and compare the various types of uncommitted and committed loan facilities provided by banks.
-
Describe and explain the different ways banks try to mitigate risk in their lending operations.
-
Compare and contrast (describe and explain the relative advantages and disadvantages) of an overdraft versus a term loan versus project finance versus a syndicated loan.
-
Why should application programs that use standing data print control totals to allow users to determine whether any changes have been made to standing data?
-
Cane Company manufactures two products called Alpha and Beta that sell for $190 and $155, respectively. Each product uses only one type of raw material that costs $8 per pound. The company has the...
-
Several months have passed and the Managing Partner approved and properly filed the Complaint and properly submitted the Request for Production of Documents that you drafted. In fact, it has been 75...
-
James Cowart started making and selling outdoor furniture in 1984. He built up the business to 300 employees and $28 million in sales in 2005. SunBright operates a single factory in northern Florida,...
-
The following questions are about your feelings toward communication with other people. Indicate the degree to which each statement applies to you by marking (5) Strongly agree, (4) Agree, (3)...
-
If an experienced secretary discovered that she made less money than a newly hired janitor, how would she react? What inputs and outcomes might she evaluate to make this comparison?
-
\(\frac{-4}{5-\sqrt{10}}\) Rationalize the denominator of the fraction, and then simplify the fraction.
-
\(\frac{6}{5+\sqrt{7}}\) Rationalize the denominator of the fraction, and then simplify the fraction.
-
\(\frac{4}{1+\sqrt{3}}\) Rationalize the denominator of the fraction, and then simplify the fraction.
Study smarter with the SolutionInn App