Linear regression in NumPy

Jianzhong Liu liujzus at gmail.com
Tue Dec 5 12:42:46 EST 2006


Hello, Guys,

I have a question about the linear_least_squares in Numpy.

My linear_least_squares cannot give me the results.

I use Numpy1.0. The newest version. So I checked online and get your 
guys some examples.

I did like this.

[john at crux 77] ~ >> py
Python 2.4.3 (#1, May 18 2006, 07:40:45)
[GCC 3.3.3 (cygwin special)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from Numeric import *
>>> from LinearAlgebra import linear_least_squares
>>> from Matrix import *
>>> y = Matrix([[1], [2], [4]])
>>> x = Matrix([[1, 1], [1, 2], [1, 3]])
>>> print y
Matrix([[1],
       [2],
       [4]])
>>> x
Matrix([[1, 1],
       [1, 2],
       [1, 3]])
>>> print linear_least_squares(x, y)

Here my Numpy stops. and never give me a result. THis is the problem of 
Numpy or sth wrong.

Can you guys give me a LinearAlgebra.py so that I can have a try?

Thanks,

John 




More information about the Python-list mailing list