Automatic curve fitting to find order of an algorithm?

I'm a newbies in mathematics.

I'm looking for an automatic best curve fitting function to find the order of an algorithm.

I would like to know if it does exists a math library function that would take an array of points (cloud of point, whatever linear or n log n or n square , ...) as input and would return the best math function that would fits my points, with the best fitting coefficient.

Does a function that try each and every type of fitting functions: log n, n log n, ..., could exists? If yes, where can I find it?

I actually implemented a Linear Regression on my points results. It help to see the trend in regards to a straight line but its not accurate. It would have been really nice to have something more advanced that would be able to check against O(n), O(n log n), O(n square), O(n), ... to determine the exact order and find each factors (multiplying constant).

Note about usage: I've done a benchmark for many ConvexHull algorithms and some Smallest Enclosing circle algorithms. I want to have a confirmation of the order (performance) of each algorithm based on tests executed on 1000 to 10000000 points.

Thanks

• are you looking for specifically polynomial fits? in what environment - C, Excel, MATLAB, Python, etc? – gt6989b May 5 '16 at 19:33
• The "best function that fits your points" is usually not what you want. Please see overfitting. – Rahul May 5 '16 at 19:43
• There is no "best" function that fits your points because each "best" function depends on the stated criteria of fitting, For example : least mean squares of errors, or of absolute errors, or relative errors, or ... many others. – JJacquelin May 5 '16 at 21:10
• @gt6989b, I don't know if what I want exists. I want and a func that will analyse each and every possibilities, linear, polynomial, ..., and tell me which one of them is the better fit to my cloud of points. – Eric Ouellet May 5 '16 at 21:11
• @JJacquelin, I heard that squares of errors is the general accepted one. I think it would be fine to me. Is it true that Squares of errors is the most used one in most general cases? – Eric Ouellet May 5 '16 at 21:14