I have two dimensional data, to which I'd like to fit a spline function. A spline would be defined as this:
y_0forx<=x_0y_0+a* (x-x_0) forx_0<=x<=x_1y_1=y_0+a* (x_1-x_0) forx>=x_1
So, constant line -> linear function -> constant line.
I want to find out values of x_0, x_1, y_0 and a minimising RMSE (or otherwise fitting well). How can I do this efficiently in Python?