cjekel / piecewise_linear_fit_py

fit piecewise linear data for a specified number of line segments
MIT License
289 stars 59 forks source link

Create a pwlf using custom coefficient #85

Open gretzteam opened 3 years ago

gretzteam commented 3 years ago

It would be useful to have the ability to create a PWLF using my own coefficient. That way all the nice built-in analysis functions would be available. One use case is to use PWLF to create an initial set of polynomials. Then quantize them (for hardware implementation) and re-create the resulting PWLF for analysis.

cjekel commented 3 years ago

There is an undocumented hack you can do, where you can specify .beta and .fit_breaks after initialization.

If follows equation 4 in the paper: image but this is only for the linear case.

How are you specifying the polynomial coefficients? maybe we can write some interface to translate your coefficients into pwlf coefficients.

I've been wanting to create a pwlf.tools, and such interface could go there?