Fits Piecewise Constant Models with Data-Adaptive Knots