[Numpy-discussion] strange behavior of numpy.random.multivariate_normal, ticket:1842
josef.pktd at gmail.com
josef.pktd at gmail.com
Thu Feb 16 08:46:01 EST 2012
On Thu, Feb 16, 2012 at 8:14 AM, <josef.pktd at gmail.com> wrote:
> On Thu, Feb 16, 2012 at 4:44 AM, Pauli Virtanen <pav at iki.fi> wrote:
>> Hi,
>>
>> 16.02.2012 06:09, josef.pktd at gmail.com kirjoitti:
>> [clip]
>>> numpy linalg.svd doesn't produce always the same results
>>>
>>> running this gives two different answers,
>>> using scipy.linalg.svd I always get the same answer, which is one of
>>> the numpy answers
>>> (numpy random.multivariate_normal is collateral damage)
>>
>> Are you using a Windows binary for Numpy compiled with the Intel
>> compilers, or maybe linked with Intel MKL?
>
> This was with the official numpy installer, compiled with MingW
>
> I just tried with 64 bit python 3.2 with MKL (Gohlke installer) and in
> several runs I always get the same answer.
>
>>
>> If yes, one possibility is that the exact sequence of floating point
>> operations in SVD or some other step in the calculation depends on the
>> data alignment, which can affect rounding error.
>>
>> See http://www.nccs.nasa.gov/images/FloatingPoint_consistency.pdf
>>
>> That would explain why the pattern you see is quasi-deterministic. The
>> other explanation would be using uninitialized memory at some point, but
>> that seems quite unlikely.
>
> Running the script on the commandline I always get several patterns,
> but running the script in the same process didn't converge to a unique
> pattern.
>
> We had other cases of several patterns in quasi-deterministic linalg
> before, but as far as I remember only in the final digits of
> precision, where it didn't matter much except for reducing test
> precision in my cases.
>
> In the random multivariate normal case in the ticket the differences
> are large, which makes them pretty unreliable and useless for
> reproducability.
linalg question
Is there anything special, or are there specific numerical problems
with an svd when most singular values are the same ?
The example has all random variables equal correlated
singular values
>>> s
array([ 3.84604989, 0.68377223, 0.68377223, 0.68377223, 0.68377223,
0.68377223, 0.68377223, 0.68377223, 0.68377223, 0.68377223])
Josef
>
> Josef
>
>>
>> --
>> Pauli Virtanen
>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion at scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
More information about the NumPy-Discussion
mailing list