I. Some Basics on Line Fitting Suppose that there is a set P of n points...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
I. Some Basics on Line Fitting Suppose that there is a set P of n points in the two-dimensional plane, denoted by (x1, y1), (2, 92),, (In, Yn), and suppose x < x < 35 30 25 that minimizes the cost function 20 15 10 5 50 40 30 20 10 2.5 4 6 Fig. 2. Two lines that fit 12 points. 12 Input: We have the following inputs: 1) A set of n points in a 2-dimensional plane 5.0 7.5 10.0 12.5 15.0 17.5 20.0 Fig. 3. Three lines that fit 18 points. problem is essentially a "modeling" problem: we want to model a set of "observed points" using a simple yet accurate model, and in this case, the model is a set of lines, each for a different interval of x. If too many lines are used, the model would not be "simple" any more. Thus, intuitively, we would like a problem formulation that requires us to fit the points well, using as few lines as possible. Let's formulate our problem, which we shall call the "Multi-Line Fitting Problem": 14 P = {(1, ), (x2, y2), , (n. Yn)} with 1 < x2 < 0. Output: A partition of the points P into k segments: P = {P, P2, Pm} P2 {Pm+1, Pm+2, P3 = {Pm2 +1:Pm2+2, Pm} Pms} E Pk = {Pmk 1+1, Pm-1+2, Pm = Pn} cost(P, C) = (P) + E(P) + + (Pk) + Ck. In the cost function cost(P, C), the part (P) + (P) + +(P) is the total error of using k lines to fit the n points, and Ck is the penalty for using k lines (namely, for partitioning the n points into k segments). The greater k is, the greater the penalty term Ck is. Note that the value of k, as well as the turning points Pm Pm," are what an algorithm solving the problem needs to decide on. 5 Pm-1 III. What to Submit In this project, you need to submit three items: (1) an algorithm report, (2) a program that implements your algorithm, (3) output of your program on test instances. 3) The proof of correctness for your algorithm. 4) the analysis of time complexity for your algorithm. A. Submission Item One: An Algorithm Report First, you are to design an efficient algorithm for the "Multi-Line Fitting Problem", and submit it as a report. The report is just like what we usually do for algorithm design in a homework, and should have the four elements as usual: 1) The main idea of your algorithm. 2) The pseudo code of your algorithm. B. Submission Item Two: A Program That Implements Your Algorithm You need to implement your algorithm using a commonly used programming language, such as Python, C++, Java, etc. We encourage you to use Python if possible, but other languages are fine, too. Your program will take a list of instances of the "Multi-Line Fitting Problem" as input, and return a list of solutions (corresponding to those instances) as its output. To test your program, we will provide you with input instances as a "dictionary" in Python (after you have submitted the program), and ask you to submit the output solutions as a "dictionary" in Python. (Details on the two files, including their formats, will be explained in the next subsection for "Submission Item Three".) When you submit your program, you need to explain clearly how to run your code. If your programming language is not Python, then you also need to include an explanation on how you turned the provided "dictionary" of "input instances" in Python to your programming language, and how you turned your "output solutions" in your programming language to a "dictionary" in Python (following the formats specified in the next subsection). I. Some Basics on Line Fitting Suppose that there is a set P of n points in the two-dimensional plane, denoted by (x1, y1), (2, 92),, (In, Yn), and suppose x < x < 35 30 25 that minimizes the cost function 20 15 10 5 50 40 30 20 10 2.5 4 6 Fig. 2. Two lines that fit 12 points. 12 Input: We have the following inputs: 1) A set of n points in a 2-dimensional plane 5.0 7.5 10.0 12.5 15.0 17.5 20.0 Fig. 3. Three lines that fit 18 points. problem is essentially a "modeling" problem: we want to model a set of "observed points" using a simple yet accurate model, and in this case, the model is a set of lines, each for a different interval of x. If too many lines are used, the model would not be "simple" any more. Thus, intuitively, we would like a problem formulation that requires us to fit the points well, using as few lines as possible. Let's formulate our problem, which we shall call the "Multi-Line Fitting Problem": 14 P = {(1, ), (x2, y2), , (n. Yn)} with 1 < x2 < 0. Output: A partition of the points P into k segments: P = {P, P2, Pm} P2 {Pm+1, Pm+2, P3 = {Pm2 +1:Pm2+2, Pm} Pms} E Pk = {Pmk 1+1, Pm-1+2, Pm = Pn} cost(P, C) = (P) + E(P) + + (Pk) + Ck. In the cost function cost(P, C), the part (P) + (P) + +(P) is the total error of using k lines to fit the n points, and Ck is the penalty for using k lines (namely, for partitioning the n points into k segments). The greater k is, the greater the penalty term Ck is. Note that the value of k, as well as the turning points Pm Pm," are what an algorithm solving the problem needs to decide on. 5 Pm-1 III. What to Submit In this project, you need to submit three items: (1) an algorithm report, (2) a program that implements your algorithm, (3) output of your program on test instances. 3) The proof of correctness for your algorithm. 4) the analysis of time complexity for your algorithm. A. Submission Item One: An Algorithm Report First, you are to design an efficient algorithm for the "Multi-Line Fitting Problem", and submit it as a report. The report is just like what we usually do for algorithm design in a homework, and should have the four elements as usual: 1) The main idea of your algorithm. 2) The pseudo code of your algorithm. B. Submission Item Two: A Program That Implements Your Algorithm You need to implement your algorithm using a commonly used programming language, such as Python, C++, Java, etc. We encourage you to use Python if possible, but other languages are fine, too. Your program will take a list of instances of the "Multi-Line Fitting Problem" as input, and return a list of solutions (corresponding to those instances) as its output. To test your program, we will provide you with input instances as a "dictionary" in Python (after you have submitted the program), and ask you to submit the output solutions as a "dictionary" in Python. (Details on the two files, including their formats, will be explained in the next subsection for "Submission Item Three".) When you submit your program, you need to explain clearly how to run your code. If your programming language is not Python, then you also need to include an explanation on how you turned the provided "dictionary" of "input instances" in Python to your programming language, and how you turned your "output solutions" in your programming language to a "dictionary" in Python (following the formats specified in the next subsection).
Expert Answer:
Answer rating: 100% (QA)
Solutions Step 1 The given question is I Some Basics on Line Fitting Suppose that there is a set P of n points in the twodimensional plane denoted by x1 y1x2 y2 xn ynand suppose x1 x 2 0 Output A part... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
In Problems 1932, find the distance d between the points P 1 and P 2 . 2FP2 = (2, 1) P1 = (0,0) -2 -1 2 x X
-
For the following exercises, use the fundamental identities to fully simplify the expression. 1 - cos x tan x + 2 sin x
-
For the lines in exercises which of the following is closest to the slope of the line? (a) 1 (b) 2 (c) 3 (d) 21 (e) 22 (f) - 3 2 2 X
-
Featherstone Inc. reported the following data: Net income ................................... $296,000 Depreciation expense ................... 113,100 Gain on disposal of equipment ...... 58,500...
-
Describe the book-tax differences that arise from nonqualified stock options granted after ASC 718 (the codification of FAS 123R)) became effective.
-
Suppose that 8% coupon pass-throughs are stripped into two classes. Class X-1 receives 75% of the principal and 10% of the interest. Class X-2 receives 25% of the principal and 90% of the interest....
-
If you invest money for five years, which will be larger? a. an investment where interest is compounded annually b. an investment where interest is compounded semiannually c. an investment where...
-
A software development project at day 70 exhibits an actual cost of $78,000 and a scheduled cost of $84,000. The software manager estimates a value completed of $81,000. What are the cost and...
-
Please finish the statement of cash flows - ?direct method. Correct the wrong answers Show all images Show all images Show all images done loading
-
In 2007, Slater & Gordon (S&G) became the worlds first law firm listed on a stock exchange. S&G is headquartered in Melbourne, where William Slater and Hugh Gordon founded it in 1935. Progressively,...
-
How do you view this case which led to the establishment of this new major precedent regarding Copyright holders? What do you think is the benefit of this ruling? What do you think will be the...
-
At Mrs.Ong's shop, there were two vases for sale at $630 each. She sold one of them at this price and earned 40 percent of what she paid for it. She sold the other vase later at a 20 percent...
-
For the following tasks, select the appropriate measurement equipment and describe its function, setup, and any safety considerations. Short Answer: Learner must select the appropriate measurement...
-
The Elliots want to buy a condo in Richmond. Banks use the affordability rule: no more than 32% of gross monthly household income can go towards paying the mortgage, property taxes, heating costs and...
-
On January 1, 2020, ACE Partnership entered into liquidation. The partners' profit sharing and capital balances on this date were as P1,250,000; C. (35%), P2,700,000; E (40%), follows: A (25%),...
-
Rotterdam Steel Inc. is expected to have a high growth rate in the next 3 years so its dividends are expected to grow at 15% per year in the next 3 years. After that dividends are expected to grow at...
-
Which of the following are true of the average exchange rate? Multiple select question. It is usually the exchange rate used to measure assets and liabilities. It is usually the exchange rate used to...
-
Question 2 For an n x n matrix A = form) via (aij)
-
Leslie and Leon Lazo are married and file a joint return for 2012. Leslie's Social Security number is 466-47-3311 and Leon's is 467-74-4451. They live at 143 Snapdragon Drive, Reno, NV 82102. For...
-
Leslie is a single taxpayer who is under age 65 and in good health. For 2012, she has a salary of $23,000 and itemized deductions of $1,000. Leslie is entitled to one exemption on her tax return. a....
-
In 2012, Lou has a salary of $54,000 from her job. She also has interest income of $1,700. Lou is single and has no dependents. During the year, Lou sold silver coins held as an investment for a...
-
What are the four types of goals?
-
Why is the execution of one-time projects closely identified with managing change?
-
Why are controls and reporting so important?
Study smarter with the SolutionInn App