cjekel / piecewise_linear_fit_py

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

add wegithed least squares approach #62

Closed cjekel closed 4 years ago

cjekel commented 4 years ago

@vkhodygo Can your review this and let me know if it address your desire in https://github.com/cjekel/piecewise_linear_fit_py/pull/60 ?

This approach uses this math: image

Example of difference between ordinary pwlf and this weighted least squares fit image

What is needed to merge into master

cjekel commented 4 years ago

I corrected the weighted sum-of-square of residuals in this equation image

vkhodygo commented 4 years ago

Hi, @cjekel

Yes, this is exactly what I wanted. I should probably close my initial PR as redundant. P.S. do you need a hand with this?

cjekel commented 4 years ago

@vkhodygo Not sure when I'll get to finishing this.

The biggest things will be getting constrained least squares to work and getting standard errors to work.

If you want to take a stab at finishing this PR, feel free to go ahead! :) I have no hard deadline for merging this.

cjekel commented 4 years ago

Edit: March 2020, going to abandon weight matrix support for now, as this is just extra work for me...