Re: fonction in python



Steven D'Aprano wrote:
On Tue, 04 Jul 2006 03:06:37 -0700, aliassaf wrote:


Hello,

If we write = x^2 and if I give to the program the values of x, it will
going to calculate the values of y, and also for x.

But it is possible ? that is if I give to the program the values of X and Y,
it will indicate to me the relation between the two variables, in the other
hand if I look to the program x=2 y=4, x=3 y=9 ect... it is going to show me
that f (t)!!!


You are asking for curve-fitting. There is a HUGE amount of work on
curve-fitting in computer science and statistics.

Generally, you start with some data points (x, y). You generally have some
idea of what sort of function you expect -- is it a straight line? A
curve? What sort of curve? A polynomial, an exponential, a sine curve, a
cubic spline, a Bezier curve?

You might like to google on "least squares curve fitting" and "linear
regression". That's just two methods out of many.

Some curve-fitting methods also estimate the error between the predicted
curve and the data points; you could then try all of the methods and pick
the one with the least error.


The problem being that complex enough models will fit the data
arbitrarily closely (i.e. over-fit). The OP should take into account
any prior expectations over the type of function (as you indicate) and
apply Occam's razor (find a relatively simple model that gives a
reasonable fit to the data).

Duncan
.



Relevant Pages

  • Re: fonction in python
    ... You are asking for curve-fitting. ... What sort of curve? ... cubic spline, a Bezier curve? ...
    (comp.lang.python)
  • Re: Limit Guessing Algorithm
    ... that converges to some finite value when x converges to infinity. ... problem with curve fitting is that the curve tends to be really close ... fit to the points. ... The problem with curve-fitting is choosing which kind of curve to fit. ...
    (comp.programming)
  • Re: Limit Guessing Algorithm
    ... that converges to some finite value when x converges to infinity. ... problem with curve fitting is that the curve tends to be really close ... fit to the points. ... The problem with curve-fitting is choosing which kind of curve to fit. ...
    (comp.programming)
  • Re: Study: calcium supplements raise heart attack risk
    ... MarilynMann wrote: ... (Y Curve). ... Sort of reminds me of Damned if you do and Damned if you don't. ... S Jersey USA Zone 5 Shade ...
    (sci.med.cardiology)
  • Re: reconstruct curve from set of points
    ... How can I sort, such that the distance between neighboring ...
    (comp.soft-sys.matlab)