I am creating a program that, given an image of a graph, is able to estimate the function of the graph. In order to do so, some basic assumptions are made such as the graph follows the same behavior outside the given domain.
I plug in all the coordinates of the graph line into a polynomial curve fitting function. In order to accurately estimate the function using polynomial regression, however, the program needs to know (roughly) the degree of the polynomial graph. How might I go about figuring this out? The solution should be able to work for almost all graphs.
Would counting the points of inflection be adequate in estimating the degree of the polynomial?
Note: the degree of the polynomial does not need to be exact, however the more accurate the degree the more accurate the results.