Implementation of intuitive, simple and fast algorithm to construct piecewise linear functions based on Imai, Hiroshi, and Masao Iri. "An optimal algorithm for approximating a piecewise linear function." Journal of information processing 9.3 (1986): 159-162 PDF from nii.ac.jp.
Note, that optimal polygon can be used as a simple change detector or for any other application where piecewise linear model is applicable.
In demo notebook you will find implementation of the same experiment which is supplied in original paper.