--
You received this message because you are subscribed to the Google Groups "lmfit-py" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lmfit-py+u...@googlegroups.com.
To post to this group, send email to lmfi...@googlegroups.com.
Visit this group at https://groups.google.com/group/lmfit-py.
To view this discussion on the web visit https://groups.google.com/d/msgid/lmfit-py/62b9443d-84cb-4b57-b99d-ee6ae6619f3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Kassym,Yes, this is a common problem. Basically, the knot points (your `lb` and `ub`) are discrete points, while the variables (your `a` and `b`) are continuous variables. In the optimization, the fit is going to first evaluate the function with `a=-80` and then with `a=-79.999999` to try to figure out which way and by how much to change `a`. But your function is not sensitive to such a variation in `a` that is smaller than 1 -- you only use it for `lb = np.argmax(x > a)`. You cannot use lmfit to fit discrete values.I think you might be able to do what you want (switch between your 'arc' function and your 'para' function) if you made the transition not discrete but more gradual, say with a logistic function that was centered at your `a` and `b` values but had a width of a few X units. Does that make sense?--Matt
On Fri, May 3, 2019 at 9:56 AM Kassym Dorsel <k.d...@gmail.com> wrote:
Hi,--I'm having troubles with a piecewise curve fitting problem where the knot points are also part of the optimization. The optimization always returns the same initial value provided for the knot points. It looks like they do not get optimized in any way. From the screenshot it is easy to see the location of the knots where the curve is discontinuous. These locations are the initial values provided during initialization. I have also drawn green lines across the curves which estimates the best positions for the knots to be.This would reduce the error and also make the returned function closer to being continuous. The piecewise uses three segments, the center one being an arc while the two outside ones being parabolas.Why does the model not optimize the knot points and what can I do to change this?Is there a way to put a constraint on the model where the segments need to be continuous at the knot points?Thanks!
You received this message because you are subscribed to the Google Groups "lmfit-py" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lmfi...@googlegroups.com.
To post to this group, send email to lmfi...@googlegroups.com.
Visit this group at https://groups.google.com/group/lmfit-py.
To view this discussion on the web visit https://groups.google.com/d/msgid/lmfit-py/62b9443d-84cb-4b57-b99d-ee6ae6619f3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Yes, that makes perfect sense. I will make the transition continuous.Looking through the documentation I see a step size when using the brute force method. Is there a way to define a minimum step size when using other fitting methods? My X data is in increments of 0.05 so I would like to define a minimum step size of ~0.06-0.1.
Changing the epsfcn gave much better results, but I found for this data the best combination was using the logistic function and changing the epsfcn value. I've included plots and the updated code.
Is there a way to add a tangential requirement between the segments?
The transition points between the segments need to be continuous.
Would I be better off moving to using the minimize() function and writing my own loss/residual function with large negative weights for step transition points?