Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task 3 ( 5 0 marks ) A fundamental problem in machine learning and data analytics is to partition or classify objects in a 'natural'

Task 3(50 marks)
A fundamental problem in machine learning and data analytics is to partition or classify
objects in a 'natural' way based on their 'distances' to each other. In this question, you
are given an integer N, and n points x1,x2,dots,xn in a horizontal line. We want to
partition the n points into N groups so that intuitively within each group the points are
'close' together. The following is an example of what may be a good way of partitioning
the following n=8 points into N=3 groups, and what may be a bad way:
More precisely, each point xi is a number on the x-axis. To measure how 'good' a
partitioning is, we define the error of a group of points xp,xp+1,dots,xq to be
(xp-)2+(xp+1-)2+cdots+(xq-)2
where =xp,xp+1,dots,xqq-p+1 is the average of the points. Our
objective is to find the optimal way of partitioning the points into N groups so that the
sum of errors of all groups is minimized.
For example, the 'bad' way of partitioning for the above example gives an error of:
Group 1: average =1+22=1.5, error =(1-1.5)2+(2-1.5)2=0.5
Group 2: average =3+6+8+124=7.25,
error =(3-7.25)2+(6-7.25)2+(8-7.25)2+(12-7.25)2=42.75
Group 3: average =13+152=14, error =(13-14)2+(15-14)2=2
Total error =0.5+42.75+2=45.25.
We divide the points in such a way that only consecutive points (along the line) may
fall into the same group.
Design an efficient algorithm for this problem. You should: (the following is described
in terms of the design of a dynamic programming algorithm, since you almost certainly
should use it)
In plain English or using some mathematical notation, give a recursive
formulation of the problem. (Hint: one possible approach is to define F(i,k)
to be the error of the optimal partition of the first i points x1,dots,xi into k
groups, where in and kN. The value of F(i,k) can be found
recursively: consider all possible locations where the last (k-th) group can
begin.)
Write a program in C++ of the algorithm that is based on this formulation
(Pseudocode may be accepted however some points will be lost).
image text in transcribed

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

Practical Database Programming With Visual Basic.NET

Authors: Ying Bai

1st Edition

0521712351, 978-0521712354

More Books

Students also viewed these Databases questions

Question

=+17.14. 1 Extend the ideas in the preceding two problems to R *.

Answered: 1 week ago

Question

Define the goals of persuasive speaking

Answered: 1 week ago