[SciPy-user] what's wrong with radom.multivariate_normal
Robert Kern
robert.kern at gmail.com
Thu Dec 15 16:57:41 EST 2005
Gary wrote:
> Alan G Isaac wrote:
>
>
>>On Thu, 15 Dec 2005, jaonary at free.fr apparently wrote:
>>
>>
>>
>>>data1 = random.multivariate_normal([0,0],[[0.5,0],[0,0.5]],[10])
>>>Traceback (most recent call last):
>>> File "<pyshell#9>", line 1, in -toplevel-
>>> data1 = random.multivariate_normal([0,0],[[0.5,0],[0,0.5]],[10])
>>> File "mtrand.pyx", line 837, in mtrand.RandomState.multivariate_normal
>>>AttributeError: 'module' object has no attribute 'singular_value_decomposition'
>>>
>>>
>>
>>>>>scipy.base.__version__
>>>>>
>>>>>
>>
>>'0.8.4'
>>
>>>>>data1 = scipy.random.multivariate_normal([0,0],[[0.5,0],[0,0.5]],[10])
>>>>>data1
>>>>>
>>>>>
>>
>>array([[ 0.24173896, 0.68537262],
>> [-0.75999958, 0.26496178],
>> [ 0.15525849, -0.61052565],
>> [-0.94612055, -0.98556872],
>> [-0.34111442, 0.86108778],
>> [ 1.09459551, 0.56298158],
>> [ 0.12430803, -0.42073144],
>> [-0.30572437, -0.6358559 ],
>> [-0.52274094, 0.00495374],
>> [-1.34852903, -0.96152263]])
>>
>>fwiw,
>>Alan Isaac
>
> yet [WinXP, python2.3]
>
> In [4]: scipy.random.multivariate_normal([0,0], [[0.5,0], [0,0.5]],[10])
> ---------------------------------------------------------------------------
> exceptions.AttributeError Traceback (most
> recent call
> last)
>
> C:\Documents and Settings\Gary\My Documents\<console>
>
> C:\Documents and Settings\Gary\My Documents\mtrand.pyx in
> mtrand.RandomState.mul
> tivariate_normal()
>
> AttributeError: 'module' object has no attribute
> 'singular_value_decomposition'
>
> In [5]: scipy.base.__version__
> Out[5]: '0.8.6.1666'
You and Jaonary have full scipy installed, so
scipy.linalg.singular_value_decomposition isn't aliased to scipy.linalg.svd as
it is in scipy_core. Alan only has scipy_core installed, I'm betting. Or at
least only the scipy_core version of scipy.linalg is being picked up in his case.
This gives me cause to raise this issue again: Let's stop trying to be clever
about these imports. The linalg and fftpack packages in scipy_core are different
from the linalg and fftpack packages in full scipy. I would greatly prefer that
they be imported differently. If one only needs the linear algebra routines
provided by scipy_core then one would import from scipy.basic.linalg (I still
prefer the names scipy.corelinalg and scipy.corefft, but I can live with the
basic package, too). Most people only need the routines in scipy.basic.linalg; I
went through the full scipy package, and it appeared that no other package used
anything from scipy.linalg that wasn't in scipy.basic.linalg.
As a bonus, we solve the fragility of importing scipy.linalg and scipy.fftpack
caused by our aliasing of the packages in scipy/__init__.py . Importing packages
should never be fragile. Users shouldn't have to import packages in a special
way just to get it to work.
--
Robert Kern
robert.kern at gmail.com
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
More information about the SciPy-User
mailing list