Re: [Numpy-discussion] statistical model fitting comparison

2008-10-21 Thread Kevin Jacobs [EMAIL PROTECTED]
On Tue, Oct 21, 2008 at 5:01 PM, Bruce Southey [EMAIL PROTECTED] wrote: I think you are on your own here as it is a huge chunk to chew! Depending on what you really mean by linear models is also part of that (the Wikipedia entry is amusing). Most people probably to stats applications like lm

Re: [Numpy-discussion] min() of array containing NaN

2008-08-13 Thread Kevin Jacobs [EMAIL PROTECTED]
On Wed, Aug 13, 2008 at 4:01 PM, Robert Kern [EMAIL PROTECTED] wrote: On Wed, Aug 13, 2008 at 14:37, Joe Harrington [EMAIL PROTECTED] wrote: On Tue, Aug 12, 2008 at 19:28, Charles R Harris [EMAIL PROTECTED] wrote: On Tue, Aug 12, 2008 at 5:13 PM, Andrew Dalke [EMAIL PROTECTED] wrote

Re: [Numpy-discussion] min() of array containing NaN

2008-08-12 Thread Kevin Jacobs [EMAIL PROTECTED]
On Tue, Aug 12, 2008 at 1:46 AM, Andrew Dalke [EMAIL PROTECTED]wrote: Here's the implementation, from lib/function_base.py def nanmin(a, axis=None): Find the minimium over the given axis, ignoring NaNs. y = array(a,subok=True) if not issubclass(y.dtype.type, _nx.integer

Re: [Numpy-discussion] import numpy is slow

2008-07-31 Thread Kevin Jacobs [EMAIL PROTECTED]
On Thu, Jul 31, 2008 at 10:14 AM, Gael Varoquaux [EMAIL PROTECTED] wrote: On Thu, Jul 31, 2008 at 12:43:17PM +0200, Andrew Dalke wrote: Startup performance has not been a numpy concern. It a concern for me, and it has been (for other packages) a concern for some of my clients. I am

Re: [Numpy-discussion] [ANNOUNCE] Traits 3.0 has been released

2008-07-31 Thread Kevin Jacobs [EMAIL PROTECTED]
On Wed, Jul 30, 2008 at 9:25 PM, Dave Peterson [EMAIL PROTECTED]wrote: Hello, I am very pleased to announce that Traits 3.0 has just been released! All of the URLs on PyPi to Enthought seem to be broken (e.g., http://code.enthought.com/traits). Can you give an example showing how traits

Re: [Numpy-discussion] ANN: PyCuda

2008-06-22 Thread Kevin Jacobs [EMAIL PROTECTED]
On Sun, Jun 22, 2008 at 3:58 PM, Andreas Klöckner [EMAIL PROTECTED] wrote: PyCuda is based on the driver API. CUBLAS uses the high-level API. Once *can* violate this rule without crashing immediately. But sketchy stuff does happen. Instead, for BLAS-1 operations, PyCuda comes with a class

[Numpy-discussion] Detecting phase windings

2008-06-16 Thread [EMAIL PROTECTED]
I have a speed problem with the approach I'm using to detect phase wrappings in a 3D data set. In my application, phaseField is a 3D array containing the phase values of a field. In order to detect the vortices/phase windings at each point, I check for windings on each of 3 faces of a 2x2 cube

[Numpy-discussion] Fancier indexing

2008-05-22 Thread Kevin Jacobs [EMAIL PROTECTED]
After poking around for a bit, I was wondering if there was a faster method for the following: # Array of index values 0..n items = numpy.array([0,3,2,1,4,2],dtype=int) # Count the number of occurrences of each index counts = numpy.zeros(5, dtype=int) for i in items: counts[i] += 1 In my real

Re: [Numpy-discussion] Fancier indexing

2008-05-22 Thread Kevin Jacobs [EMAIL PROTECTED]
On Thu, May 22, 2008 at 12:08 PM, Keith Goodman [EMAIL PROTECTED] wrote: How big is n? If it is much smaller than a million then loop over that instead. n is always relatively small, but I'd rather not do: for i in range(n): counts[i] = (items==i).sum() If that was the best alternative

Re: [Numpy-discussion] varu and stdu

2008-04-07 Thread Kevin Jacobs [EMAIL PROTECTED]
PROC MEANS parameter name as an arbitrary example). In the extremely rare cases I need any other denominator, I'm fine with multiplying by var(x)*n/(n-adjust). -Kevin On Mon, Apr 7, 2008 at 9:41 AM, Pierre GM [EMAIL PROTECTED] wrote: Anne, Travis, I have no problem to get rid of varu and stdu

[Numpy-discussion] improving code

2008-03-16 Thread [EMAIL PROTECTED]
hello while trying to write a function that processes some numpy arrays and calculate euclidean distance ,i ended up with this code #some samplevalues totalimgs=17 selectedfacespaces=6 imgpixels=18750 (ie for an image of 125X150 ) ... # i am using these arrays to do the calculation facespace

Re: [Numpy-discussion] confusion about eigenvector

2008-03-03 Thread [EMAIL PROTECTED]
Arnar wrote I dont know if this made anything any clearer. However, a simple example may be clearer: # X is (a ndarray, *not* matrix) column centered with vectorized images in rows # method 1: XX = dot(X, X.T) s, u = linalg.eigh(XX) reorder = s.argsort()[::-1] facespace = dot(X.T,

[Numpy-discussion] svd() and eigh()

2008-03-01 Thread [EMAIL PROTECTED]
hi i have a set of images of faces which i make into a 2d array using numpy.ndarray each row represents a face image faces= [[ 173. 87. ... 88. 165.] [ 158. 103. .. 73. 143.] [ 180. 87. .. 55. 143.] [ 155. 117. .. 93. 155.]] from which i can get the mean image =

Re: [Numpy-discussion] confusion about eigenvector

2008-03-01 Thread [EMAIL PROTECTED]
I dont know if this made anything any clearer. However, a simple example may be clearer: thanks Arnar for the kind response,now things are a lot clearer...will try out in code .. D ___ Numpy-discussion mailing list Numpy-discussion@scipy.org

[Numpy-discussion] image to array doubt

2008-02-29 Thread [EMAIL PROTECTED]
hi i came across a codebase by rice univ people..in that there are some functions for conversion btw image and vectors 1.code def image_to_vector(self, filename): try: im = Image.open(filename) except IOError: print 'couldn\'t load ' + filename

Re: [Numpy-discussion] image to array doubt

2008-02-29 Thread [EMAIL PROTECTED]
Robin wrote I'm not sure why they would be doing this - to me it looks they might be using Image as a convenient way to store some other kind of data... thanks Robin, I am wondering if there is a more straightforward way to do these.. especially the vector to image function D

[Numpy-discussion] PCA on set of face images

2008-02-29 Thread [EMAIL PROTECTED]
hi guys I have a set of face images with which i want to do face recognition using Petland's PCA method.I gathered these steps from their docs 1.represent matrix of face images data 2.find the adjusted matrix by substracting the mean face 3.calculate covariance matrix (cov=A* A_transpose) where

Re: [Numpy-discussion] PCA on set of face images

2008-02-29 Thread [EMAIL PROTECTED]
On Mar 1, 12:57 am, Peter Skomoroch wrote: I think matlab example should be easy to translate to scipy/matplotlib using the montage function: load faces.mat %Form covariance matrix C=cov(faces'); %build eigenvectors and eigenvalues [E,D] = eig(C); hi Peter, nice code..ran the

Re: [Numpy-discussion] confusion about eigenvector

2008-02-29 Thread [EMAIL PROTECTED]
This example assumes that facearray is an ndarray.(like you described in original post ;-) ) It looks like you are using a matrix. hi Arnar thanks .. a few doubts however 1.when i use say 10 images of 4X3 each u, s, vt = linalg.svd(facearray, 0) i will get vt of shape (10,12) can't i take

Re: [Numpy-discussion] confusion about eigenvector

2008-02-28 Thread [EMAIL PROTECTED]
On Feb 28, 1:27 pm, Matthieu Brucher wrote If your images are 4x3, your eigenvector must be 12 long. hi thanx for reply i am using 4 images each of size 4X3 the covariance matrix obtained from adjfaces*faces_trans is 4X4 in size and that produces the evalues and eigenvectors given here

Re: [Numpy-discussion] confusion about eigenvector

2008-02-28 Thread [EMAIL PROTECTED]
Arnar wrote from scipy import linalg facearray-=facearray.mean(0) #mean centering u, s, vt = linalg.svd(facearray, 0) scores = u*s facespace = vt.T hi Arnar when i do this i get these u = 'numpy.core.defmatrix.matrix' (4, 4) that matches the eigenvectors matrix in my previous data s=

Re: [Numpy-discussion] finding eigenvectors etc

2008-02-20 Thread [EMAIL PROTECTED]
Different implementations follow different conventions as to which is which. thank you for the replies ..the reason why i asked was that the most significant eigenvectors ( sorted according to eigenvalues) are later used in calculations and then the results obtained differ in java and

Re: [Numpy-discussion] finding eigenvectors etc

2008-02-20 Thread [EMAIL PROTECTED]
How are you using the values? How significant are the differences? i am using these eigenvectors to do PCA on a set of images(of faces).I sort the eigenvectors in descending order of their eigenvalues and this is multiplied with the (orig data of some images viz a matrix)to obtain a

[Numpy-discussion] finding eigenvectors etc

2008-02-19 Thread [EMAIL PROTECTED]
hi i was calculating eigenvalues and eigenvectors for a covariancematrix using numpy adjfaces=matrix(adjarr) faces_trans=adjfaces.transpose() covarmat=adjfaces*faces_trans evalues,evect=eigh(covarmat) for a sample covarmat like [[ 1.69365981e+13 , -5.44960784e+12, -9.00346400e+12 ,

Re: [Numpy-discussion] parallel numpy (by Brian Granger) - any info?

2008-01-08 Thread Kevin Jacobs [EMAIL PROTECTED]
On 1/8/08, Matthieu Brucher [EMAIL PROTECTED] wrote: I have AMD processor so I guess I should use ACML somehow instead. However, at 1st I would prefer my code to be platform-independent, and at 2nd unfortunately I haven't encountered in numpy documentation (in website scipy.org

Re: [Numpy-discussion] [C++-sig] Overloading sqrt(5.5)*myvector

2007-12-27 Thread Kevin Jacobs [EMAIL PROTECTED]
problem you need to solve is getting Boot to generate the appropriate __rmul__ method. The second problem, if it even exists, is ensuring that __mul__ returns NotImplemented. Best of luck, -Kevin On Dec 27, 2007 10:15 AM, Bruce Sherwood [EMAIL PROTECTED] wrote: I should have added

[Numpy-discussion] any better way to normalise a matrix

2007-12-27 Thread [EMAIL PROTECTED]
in my code i am trying to normalise a matrix as below mymatrix=matrix(..# items are of double type..can be negative values) numrows,numcols=mymatrix.shape for i in range(numrows): temp=mymatrix[i].max() for j in range(numcols):

[Numpy-discussion] matrix multipln takes too much time

2007-12-25 Thread [EMAIL PROTECTED]
hi i am doing some maths calculations involving matrices of double values using numpy.matrix , java code for this is something like int items=25; int sample=5; int totalcols=8100; double[][]dblarrayone=new double[items][totalcols]; double[][]dblarraytwo=new double[items][totalcols]; //their

Re: [Numpy-discussion] matrix multipln takes too much time

2007-12-25 Thread [EMAIL PROTECTED]
on my computer I have: 1.15.6 sec with your code 2.0.072 sec with resultmatrix2 3.0.040 sec with tensordot (resultmatrix3) (-- which is a 400x speed) wow ,thanks! the tensordot fn is blinding fast.. i added /modified resultndarray = tensordot(matrixone[:sample,:], matrixtwo.T,

[Numpy-discussion] setting items in a matrix

2007-12-20 Thread [EMAIL PROTECTED]
hi i am a beginner with numpy and python,so pardon me if this doubt seems silly i want to create a matrix with say 3 rows and 5 columns..and then set the values of each item in it .for this i did something like below myarray=zeros((3,5)) #then set the items for row in range(3): for col in

[Numpy-discussion] setting items in a matrix

2007-12-20 Thread [EMAIL PROTECTED]
hi i am a beginner with numpy and python,so pardon me if this doubt seems silly i want to create a matrix with say 3 rows and 5 columns..and then set the values of each item in it .for this i did something like below myarray=zeros((3,5)) #then set the items for row in range(3): for col in

Re: [Numpy-discussion] numpy : your experiences?

2007-11-22 Thread [EMAIL PROTECTED]
In particular for the simulation yes, depending on the level of detail of course. But only parts, eg. random number generation for certain distributions had to be coded in C/C++. Are you saying you extended the scipy/numpy tools for this? Do you think it would make sense to put some of

Re: [Numpy-discussion] numpy : your experiences?

2007-11-21 Thread [EMAIL PROTECTED]
a) Can you guys tell me briefly about the kind of problems you are tackling with numpy and scipy? I'm using python with numpy,scipy, pytables and matplotlib for data analysis in the field of high energy particle physics. Most of the work is histograming millions of events, fitting functions to

[Numpy-discussion] how to convert btw rgb and pixel value

2007-11-04 Thread [EMAIL PROTECTED]
hi i wish to convert an rgb image into an array of double values..is there a method for that in numpy? also i want to create an array of doubles into corresponding rgb tuples of an image can anyone guide me? dn ___ Numpy-discussion mailing list

Re: [Numpy-discussion] how to get/set column

2007-11-01 Thread [EMAIL PROTECTED]
It's just the other way around: mymat[:,0] # first column mymat[:,1] # second column Take a look at the tutorial: http://scipy.org/Tentative_NumPy_Tutorial#head-864862d3f2bb4c32f04260fac61eb4ef34788c4c best! bernhard On Nov 1, 7:22 am, dev new [EMAIL PROTECTED] wrote: is there a method

Re: [Numpy-discussion] Getting an item in an array with its coordinates given by another array

2007-10-29 Thread [EMAIL PROTECTED]
Take a look at numpy.ix_ http://www.scipy.org/Numpy_Example_List_With_Doc#head-603de8bdb62d0412798c45fe1db0648d913c8a9c This method creates the index array for you. You only have to specify the coordinates in each dimesion. Bernhard On Oct 29, 8:46 am, Matthieu Brucher [EMAIL PROTECTED] wrote

Re: [Numpy-discussion] anyone compiling on IRIX 6.5

2007-10-24 Thread [EMAIL PROTECTED]
Jarrod Millman wrote: Hello, I am hoping to close a few of the remaining tickets for the upcoming NumPy 1.0.4 release. Is anyone using NumPy on IRIX? Or have access to IRIX? If so, could you please take a look at this ticket: http://projects.scipy.org/scipy/numpy/ticket/417 Thanks,

Re: [Numpy-discussion] anyone compiling on IRIX 6.5

2007-10-24 Thread [EMAIL PROTECTED]
Hi David, David Cournapeau wrote: [EMAIL PROTECTED] wrote: Jarrod Millman wrote: Hello, I am hoping to close a few of the remaining tickets for the upcoming NumPy 1.0.4 release. Is anyone using NumPy on IRIX? Or have access to IRIX? If so, could you please take a look at this ticket

Re: [Numpy-discussion] expm

2007-07-20 Thread Kevin Jacobs [EMAIL PROTECTED]
On 7/20/07, Anne Archibald [EMAIL PROTECTED] wrote: On 20/07/07, Nils Wagner [EMAIL PROTECTED] wrote: lorenzo bolla wrote: hi all. is there a function in numpy to compute the exp of a matrix, similar to expm in matlab? for example: expm([[0,0],[0,0]]) = eye(2) Numpy doesn't provide

Re: [Numpy-discussion] expm

2007-07-20 Thread Kevin Jacobs [EMAIL PROTECTED]
On 7/20/07, Nils Wagner [EMAIL PROTECTED] wrote: Your sqrtm_eig(x) function won't work if x is defective. See test_defective.py for details. I am aware, though at least on my system, the SVD-based method is by far the fastest and robust (and can be made more robust by the addition

Re: [Numpy-discussion] expm

2007-07-20 Thread Kevin Jacobs [EMAIL PROTECTED]
On 7/20/07, Nils Wagner [EMAIL PROTECTED] wrote: Your sqrtm_eig(x) function won't work if x is defective. See test_defective.py for details. I've added several defective matrices to my test cases and the SVD method doesn't work well as I'd thought (which is obvious in retrospect). I'm

Re: [Numpy-discussion] expm

2007-07-20 Thread Kevin Jacobs [EMAIL PROTECTED]
On 7/20/07, Charles R Harris [EMAIL PROTECTED] wrote: I expect using sqrt(x) will be faster than x**.5. I did test this at one point and was also surprised that sqrt(x) seemed slower than **.5. However I found out otherwise while preparing a timeit script to demonstrate this observation

Re: [Numpy-discussion] expm

2007-07-20 Thread Kevin Jacobs [EMAIL PROTECTED]
On 7/20/07, Kevin Jacobs [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On 7/20/07, Charles R Harris [EMAIL PROTECTED] wrote: I expect using sqrt(x) will be faster than x**.5. I did test this at one point and was also surprised that sqrt(x) seemed slower than **.5. However I found out

Re: [Numpy-discussion] NumPy/SciPy LAPACK version

2007-07-16 Thread Kevin Jacobs [EMAIL PROTECTED]
Mea culpa on the msqrt example, however I still think it is wrong to get a complex square-root back when a real valued result is expected and exists. -Kevin On 7/16/07, Hanno Klemm [EMAIL PROTECTED] wrote: Kevin, the problem appears to be that sqrtm() gives back an array, rather than

[Numpy-discussion] scipy.test() warnings, errors and failures

2007-07-07 Thread [EMAIL PROTECTED]
Hi, I just installed numpy (1.0.3) and scipy (0.5.2) on a Windows machine running Python 2.5.1. They both complete installation, and numpy.test() reports no errors. scipy.test() produces a huge stream (see below) of warnings, errors (19), and failures (2), however. Also, there's a deprecation

Re: [Numpy-discussion] best way of counting time and cputime?

2007-05-14 Thread [EMAIL PROTECTED]
Is the genutils module not included to standard CPython edition? It's not. It's a sub-module of IPython. It's based on the resource module,though and that comes with Python on Linux. Just define the function Fernando posted: def clock(): clock() - floating point number

Re: [Numpy-discussion] best way of counting time and cputime?

2007-05-12 Thread [EMAIL PROTECTED]
the difference, gives the elapsed time) and time.clock (under linux the cpu clock time used by the process) are the methods you want. Cheers! Bernhard On May 12, 12:22 am, dmitrey [EMAIL PROTECTED] wrote: hi all, please inform me which way for counting elapsed time and cputime in Python is best

Re: [Numpy-discussion] Assembling an array from parts

2007-04-01 Thread Kevin Jacobs [EMAIL PROTECTED]
I had to poke around before finding it too: bmat( [[K,G],[G.T, zeros(nc)]] ) On 4/1/07, Bill Baxter [EMAIL PROTECTED] wrote: What's the best way of assembling a big matrix from parts? I'm using lagrange multipliers to enforce constraints and this kind of matrix comes up a lot: [[ K, G