Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Slope of Segment to 0 #107

Open
markcdaley opened this issue Nov 2, 2022 · 2 comments
Open

Set Slope of Segment to 0 #107

markcdaley opened this issue Nov 2, 2022 · 2 comments

Comments

@markcdaley
Copy link

markcdaley commented Nov 2, 2022

Hello!

I was super excited to find this library as I have implemented the 'segmented' library in R, but was hoping to use it in Python. I have a set of data that I am trying to fit with two line segments. For the left segment, I want to force the slope to be zero so that the fit is horizontal in that one segment only. This is possible in R with the segmented library, but I can't figure out if this is possible with pwlf. Any chance this is easily implemented? I know this is similar to another question from August (#105), but I couldn't get that method to work. Thanks for any help you can provide!

For reference here is the R code and an attached image of the output. The slope of the right portion is not always similar under the slope constraints, just in this example.

image

Segmented_Example

@cjekel
Copy link
Owner

cjekel commented Nov 2, 2022

I never ended up merging this feature request for mixed degrees. Take a look at #41 using a degree_list=[0,1]. It was a rather small commit ef58aaa I just didn't get around to finishing the grunt work to make sure it didn't break any of the other behavior. Happy to accept a PR to get this in sooner.

@markcdaley
Copy link
Author

Awesome, thanks, Charles, that seemed to work for my application! I'll see what comes up as I'm working with it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants