I am working with different machine learning algorithms for my dataset. I am using python. I am a beginner in machine learning.

This is the visualization of my dataset. It is understandable there linear regression won't perform well for the whole set.

I am willing to divide the graph into 3 regions. Like this image. I want to have 3 regions which are a constant part, polynomial part, and a linear part.

I want to predict X first, then need to know in which part it lies and then it will fit the model according to the part. Like if X lies on the polynomial part the system will identify as polynomial part and it needs to fit as polynomial regression.

My question is how can I implement it in such a way?