I have been trying to implement this algorithm in Python for several days. I go back to him all the time and just refuse disappointment. I do not know what's happening. I donโt have anyone to ask or ask for help somewhere so I can come here.
Warning in PDF: http://www.cs.uiuc.edu/class/sp08/cs473/Lectures/lec10.pdf
I do not think that he was clearly explained, I definitely do not understand.
My understanding of what is going on:
We have many points (x1, y1), (x2, y2) .. and we want to find some lines that best fit this data. We can have several straight lines, and these lines come from the given forums for a and b (y = ax + b).
Now the algorithm starts at the end (?) And assumes that the point p (x_i, y_i) is part of the line segment. Then the notes say that the optimal solution is "the optimal solution for {p1,., Pi-1} plus the (best) line through {pi,., Pn}". Which for me simply means that we go to the point p (x_i, y_i) and go back and find another line segment through the other points. Now the optimal solution is both of these segments.
Then it takes a logical transition, which I cannot follow, and says: "Suppose that the last point pn is part of a segment that starts with p_i. If Opt (j) denotes the cost of the first j points and e (j, k) is an error the best line through the points j to k, then Opt (n) = e (i, n) + C + Opt (i - 1) "
Then there is pseudo code for an algorithm that I do not understand. I understand that we want to iterate over the list of points and find points that minimize the OPT (n) formula, but I just don't follow it. It makes me feel stupid.
I know that this question is a pain in the ass, and that it is not easy to answer, but I'm just looking for some recommendations for understanding this algorithm. I apologize for the PDF, but I don't have a more accurate way to get critical information for the reader.
Thanks for your time and by reading this, I appreciate it.