I'm running a job in college and would like to implement a function that calculates a regressão linear
. Given the points and the number of desired exponents, I want as a return the coefficients of the equation. For example, given the points below, and stating that I want only one exponent, I would like me to return the coefficients a
and b
of the 1st degree equation.
>>> x = [0.4, 0.6, 0.8, 1.4]
>>> y = [1.4, 2.1, 3.5, 6.7]
Any ideas?