-
Notifications
You must be signed in to change notification settings - Fork 59
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
Add Constraint #26
Comments
I could potentially create a constrained fit where each breakpoint is subjected to per-determined constraints. The following code sets up this constraint lower and upper limits, just as an example. # for two breakpoints; arbitrary example
# 0.1 <= breakpoint[0] <= 0.15
# 0.5 <= breakpoint[1] <= 0.7
g = np.zeros((2, 2) # constraints
g[0, 0] = 0.1
g[0, 1] = 0.15
g[1, 0] = 0.5
g[1, 1] = 0.7 Then the optimization would find the best Do I understand this correctly? |
For now this could be done using a custom optimizer like https://jekel.me/piecewise_linear_fit_py/examples.html#use-custom-optimization-routine where you manually specify the bounds. I'll try to include an optional bounds parameter in the fitting routines for this case. |
@adussarps I'm not sure if I understand your request to constrain linear coefficients, but I added an option to constrain the search space for breakpoints. Does this example solver your issue? or are you looking to add constraints for each slope (and the change from the previous slope)? |
Yes it's fine thanks!! |
Add an option to constraint linear coefficients to a range of values (e.g >0 ).
The text was updated successfully, but these errors were encountered: