Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CS4347: Homework # 1. (50 pt) The k-means algorithm is pretty straight forward. Here is the pseudo-code for it. Please implement k-means on 2-dimensional numerical

image text in transcribed

image text in transcribed

image text in transcribed

CS4347: Homework # 1. (50 pt) The k-means algorithm is pretty straight forward. Here is the pseudo-code for it. Please implement k-means on 2-dimensional numerical data by C++, which should be fairly easy to derive from this. Let k be the number of clusters vou want Let S be the set of data samples (S is the size of the set) Let A be the set of associate clusters for each data sample Let sim(x.y) be the similarity function Let c[k] be the vectors for cluster centers Init Let S. = S /choose k random vectors to start our clusters for i-1 to k rand(S S-S- e[n]) //remove that vector from S' so we can't choose it again end Wassign initial clusters for i= l to SI A[i] = arginin(j = 1 to k) { sim(S[i], c(j]); end Run: Let change-true /recalculate cluster locations if a change occurred if change for i = l to k mean, count 0 for j-1 to S if Ali]-. mean = mean + S[j] count = count + 1 end end c[i] mean/count end end while change = false /assume there is no change change- /reassign feature vectors to clusters for i = l to S a = argmin(j = l to k) { sim(s[i], cli) } if a!-A[i) A[i] = a

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago