Definition
Segmented Least Squares Problem
Given a set of points , sorted by their -coordinates, the objective is to find a partition of these points into segments that minimise the loss function:
where:
- is the sum of squared errors over all segments. For a single segment points from index to , the error is , where is the best fit line for that segment
- is a predefined constant penalty for each segment
- is the total number of segments in the partition
Approaches
Dynamic Programming
This problem can be efficiently solved using dynamic programming: