[SciPy-user] 'linear regression'
Alan G Isaac
aisaac at american.edu
Thu Jun 30 01:48:38 CDT 2005
On Sun, 05 Jun 2005, David Grant apparently wrote:
1. For something like this I think GPL is major overkill.
How about public domain, or at least MIT? (The comments
below are in the public domain. ;-))
2. In the loop
for i in range(len(x)):
data[i] = (x[i],y[i],(max(abs(y))+min(abs(y)))/100.)
I think you could:
- omit the weight. In any case, you chose a weight that
does not look generally optimal (but will not usually
hurt or help).
- compute the weight outside the loop
- let data=zip(x,y,repeat(wt)) (for whatever weight you
choose, if you use one) (repeat is in itertools)
3. For your stated purpose, if I understood, you do not need
nonlinear LS and could use a linear solution (noniterative).
(Scipy has this.)
4. An object oriented approach seems more natural here,
perhaps, especially given your reliance on Scientific
Point 2 seems to raise a question for Konrad: might allowing
leastSquaresFit to accept an iterator instead of a list as
data have some advantages?
More information about the SciPy-user