I have an experimental data, which is piecewise continuous, and each part should fit linearly. However, I would like to fit it without knowing where exactly are the knots (so the points where the slope is changing), since its not easy to determine them manually.
So far I found the advice of using py-earth for this task, but couldn't understand how to implement it; that is, having just a list of variables for X and Y, how to be able to do such piecewise linear regression. Could anybody give me advice on how to do that?
UPD: Turned out, the problem was because of the different format of array. "X=numpy.array([X]).T" for my arrays solved it, and now py_earth is working. However, it's to "rough", showing one single line for several knots. Can anybody suggest some other solution for the piecewise linear regression?