Search code examples
pythonmachine-learningcurve-fittingcurvetrend

How to find trend in data set with python


I am trying to find the curve equation that is the nearest approximation of the trend in the data. I have tried with curve fit, poly1d but none of them give the results I am looking for.

enter image description here

On the picture, the scatter part is the data that I have. The freehand drawn line is the trend that I would like to get.

Can someone please help me? How can I attempt to get to the solution or at least guide me to the right algorithms that can get me there?

I uploaded the data to the git; x and y dataset files.

https://github.com/tadejales/stackoverflow_question.git


Solution

  • Before using ready-made softwares often it is of interest to have a short inspection of the problem. In the present case the shape of the cloud of points makes think of drawing it in log-log scales :

    enter image description here

    Then from this rough fitting one obtains :

    enter image description here

    Now one can use a specialised software if a better result is expected. The above function and rough numerical values of parameters will be usefull to start the calculus.