Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Greetings, Could someone please help with this R programming exercise? Use the k-means clustering algorithm to look for patterns in an unlabeled dataset. The dataset

Greetings,

Could someone please help with this R programming exercise?

Use the k-means clustering algorithm to look for patterns in an unlabeled dataset. The dataset is below.

1- Plot the dataset using a scatter plot.

2- Fit the dataset using the k-means algorithm from k=2 to k=12. Perform a scatter plot of the resultant clusters for each value of k.

As k-means is an unsupervised algorithm, you cannot compute the accuracy as there are no correct values to compare the output to. Instead, you will use the average distance from the center of each cluster as a measure of how well the model fits the data. To calculate this metric, simply compute the distance of each data point to the center of the cluster it is assigned to and take the average value of all of those distances.

3- Calculate this average distance from the center of each cluster for each value of k and plot it as a line chart where k is the x-axis and the average distance is the y-axis.

4- One way of determining the "right" number of clusters is to look at the graph of k versus average distance and find the "elbow point." Looking at the graph you generated in the previous example, what is the elbow point for this dataset?

This the dataset:

x y
46 236
69 236
144 236
171 236
194 236
195 236
221 236
244 236
45 235
47 235
48 235
49 235
50 235
51 235
52 235
53 235
54 235
55 235
56 235
57 235
58 235
59 235
60 235
61 235
62 235
63 235
64 235
65 235
66 235
67 235
68 235
145 235
146 235
147 235
148 235
149 235
150 235
151 235
152 235
153 235
154 235
155 235
156 235
157 235
158 235
159 235
160 235
161 235
162 235
163 235
164 235
165 235
166 235
167 235
168 235
169 235
170 235
172 235
173 235
174 235
175 235
176 235
177 235
178 235
179 235
180 235
181 235
182 235
183 235
184 235
185 235
186 235
187 235
188 235
189 235
190 235
191 235
192 235
193 235
196 235
197 235
198 235
199 235
200 235
201 235
202 235
203 235
204 235
205 235
206 235
207 235
208 235
209 235
210 235
211 235
212 235
213 235
214 235
215 235
216 235
217 235
218 235
219 235
220 235
222 235
223 235
224 235
225 235
226 235
227 235
228 235
229 235
230 235
231 235
232 235
233 235
234 235
235 235
236 235
237 235
238 235
239 235
240 235
241 235
242 235
243 235
245 235
246 235
247 235
248 235
249 235
46 234
145 234
146 234
147 234
148 234
149 234
150 234
151 234
152 234
153 234
154 234
155 234
156 234
157 234
158 234
159 234
160 234

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_2

Step: 3

blur-text-image_3

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

Elementary Point-Set Topology A Transition To Advanced Mathematics

Authors: Andre L Yandl, Adam Bowers

1st Edition

0486811018, 9780486811017

More Books

Students also viewed these Mathematics questions

Question

Prove d/dx ln |ax| = d/dx ln |x| for any constant a.

Answered: 1 week ago