  Given a financial time series data, one of the most fundamental and
interesting challenges is the need to learn the stock dynamics signals in a
financial time series data. A good example is to represent the time series in
line segments which is often used as a pre-processing step for learning
marketing signal patterns in financial computing. In this paper, we focus on
the problem of computing the optimal segmentations of such time series based on
segmented linear regression models. The major contribution of this paper is to
define the problem of Multi-Segment Linear Regression (MSLR) of computing the
optimal segmentation of a financial time series, denoted as the MSLR problem,
such that the global mean square error of segmented linear regression is
minimized. We present an optimum algorithm with two-level dynamic programming
(DP) design and show the optimality of OMSLR algorithm. The two-level DP design
of OMSLR algorithm can mitigate the complexity for searching the best trading
strategies in financial markets. It runs in O($kn^2$) time, where $n$ is the
length of the time series sequence and $k$ is the number of non-overlapping
segments that cover all data points.
