Python Forum

Full Version: Best Fit In Python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all

I was wondering is anyone could give me some guidance on how to solve the following problem.

I have list of numbers that represent temperature (shown on the picture in blue).

After plotting the data the general trend of the number is more or less the same and then gradually increases linearly and then becomes more or less constant.

I have created a second plot to show the best fit trend of the values.

Is there any way of writing a program such that i would enter the existing values and Python would find the best fit orange line?

I just need some general ideas and push in the right direction thats all.

Thank you.
SciPy's optimize module includes functions for least squares and curve fitting: https://docs.scipy.org/doc/scipy/referen...imize.html.
Scikit-learn does a great job with regressions.