Linear regression in NumPy

Matt Crema crema at bu.edu
Sat Mar 18 12:40:32 EST 2006


nikie wrote:
> 
> <SNIP Found that polyfit is a useful built-in tool for linear regression>

Hello,

I'm glad that helped, but let's not terminate this discussion just yet. 
  I am also interested in answers to your second question:

nikie wrote:

 > "More generally: Is there any kind of documentation that tells me what
 > the functions in NumPy do, and what parameters they expect, how to
 > call them, etc.

As I said, I'm also new to numpy (only been using it for a week), but my 
first impression is that the built-in documentation is seriously 
lacking.  For example, the Mathworks docs absolutely crush numpy's.  I 
mean this constructively, and not as a shot at numpy.

<Robert Kern> gave an excellent answer, but I differ with his one point 
that the docstring for "numpy.linalg.lstsq?" contains an obvious answer 
to the question.  Good documentation should be written in much simpler 
terms, and examples of the function's use should be included.

I wonder if anyone can impart some strategies for quickly solving 
problems like "How do I do a linear fit in numpy?" if, for example, I 
don't know which command to use.

In Matlab, I would have typed:
"lookfor fit"
It would have returned 'polyval'.  Then:
"help polyval"

and this problem would have been solved in under 5 minutes.

To sum up a wordy post, "What do experienced users find is the most 
efficient way to navigate the numpy docs?  (assuming one has already 
read the FAQs and tutorials)"

Thanks.
-Matt



More information about the Python-list mailing list