Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| courses:cs211:winter2018:journals:thetfordt:chapter6 [2018/03/26 18:17] – thetfordt | courses:cs211:winter2018:journals:thetfordt:chapter6 [2018/03/26 18:32] (current) – thetfordt | ||
|---|---|---|---|
| Line 26: | Line 26: | ||
| ===== Section 6.3 - Segmented Least Squares: Multi-way Choices ===== | ===== Section 6.3 - Segmented Least Squares: Multi-way Choices ===== | ||
| + | In the previous sections, we opened the logic of solving the problems with a binary choice: either the final job lied in the solution or it did not. But this is not always the case. In this section, we will tackle a multi-way choice problem. | ||
| + | The problem we will be examining has to do with points on an x-y plane. We know how to minimize the sum of squares with a set of points by creating a best-fit line. But if we could have multiple lines? And what if we wanted to minimize both the sums of squares (have an accurate best-fit line), but also minimize the number of lines used in order to minimize the sums of squares. | ||
| + | Say that we are given a set of points on an x-y plane. We need to create a penalty of partitioning the x-values (to create a new line). We see that the penalty of a partition is | ||
| + | (i) the number of segments into which we partition P, times a fixed given multiplier C>0 | ||
| + | (ii) For each segment, the error value of the optimal line through that segment. | ||
| + | |||
| + | Our goal here is to find a partition such that we minimize our penalty. The section walks through a few subproofs before laying out the algorithm itself. First, we call e(i,j) the minimum error of any line with respect to points p_i,...,p_j (points ordered by increasing x-value). The book lays out the fact that if the last segment of the optimal partition is p_i, | ||
| + | |||
| + | The algorithm defines an array M[0,...,n], and sets M[0] = 0. ANd for all pairs with i<=j, we compute the least squares error e(i,j) for the segment p_i, | ||
| + | |||
| + | I was absent from class during the coverage of this material, so this section was a little more difficult for me to digest. Altough, I found the book's explanations fairly straight-forward. I would rate the readability of this section at 7/10. | ||
