Closed lk1983823 closed 5 years ago
What happens when you run fit(9) ?
On Fri, May 17, 2019, 10:08 Kuan Lu(Frank) notifications@github.com wrote:
I want fit the data (yellow ones),using piecewise horizontal and vertical lines but failed. Could pwlf make it possible? [image: 微信截图_20190517220312] https://user-images.githubusercontent.com/20237650/57933610-4fee1d00-78f0-11e9-8f16-68d39bff58dd.png
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cjekel/piecewise_linear_fit_py/issues/31?email_source=notifications&email_token=ADJ5Z4OLPFGWY7MOEFWPOIDPV236XA5CNFSM4HNVTOKKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GUNGJKA, or mute the thread https://github.com/notifications/unsubscribe-auth/ADJ5Z4KV6FAMXI6DLJBVUBDPV236XANCNFSM4HNVTOKA .
Although it can fit the data using 10 piecewise, the lines are not strictly horizontal and vertical. BTW the blue line is not from pwlf.
Below is a reslut using pwlf with fit(10), but the lines are not strictly horizontal and vertical. So I want to add contraints to pwlf to meet my requirtemnt.
I'd be willing to collaborate on this if it will be useful and you can send me an email with more details, but I probably won't include the functionality in pwlf.
How many square waves do you expect? and will the data be periodic. (Thousands of square waves of non periodic data may be challenging...)
On Sat, May 18, 2019, 09:24 Kuan Lu(Frank) notifications@github.com wrote:
Below is a reslut using pwlf with fit(11). So I want to add contraints to pwlf to make sure the line be strictly horizontal or vertical. [image: 微信截图_20190518092257] https://user-images.githubusercontent.com/20237650/57962829-86f31b80-794e-11e9-9bd1-9bdd52429fa1.png
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cjekel/piecewise_linear_fit_py/issues/31?email_source=notifications&email_token=ADJ5Z4LR5RIAACJ6U7PXCMTPV5LFTA5CNFSM4HNVTOKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVWFA4I#issuecomment-493637745, or mute the thread https://github.com/notifications/unsubscribe-auth/ADJ5Z4MEC5JS5QLN7VZMYXLPV5LFTANCNFSM4HNVTOKA .
I have send an email to you with data and code of my early work.
For those interested, I have a development branch to include this functionality. https://github.com/cjekel/piecewise_linear_fit_py/tree/constants
I added a degree keyword which you can specify what degree piecewise polynomial to use.
my_pwlf = pwlf.PiecewiseLinFit(x, y, degree=0) # constants
my_pwlf = pwlf.PiecewiseLinFit(x, y, degree=1) # linear (default)
my_pwlf = pwlf.PiecewiseLinFit(x, y, degree=2) # quadratic
It needs more testing before being merged.
Thank you! I will try it.
Let me keep this open for now. There are some issues with the implementation. (The number of parameters counts are incorrect for polynomials, no tests, etc.). I'll close this issue when it's been fully merged.
I want fit the data (yellow ones),using piecewise horizontal and vertical lines but failed. Could pwlf make it possible?