[Tutor] HELP- Regarding working with python
eryksun
eryksun at gmail.com
Fri Jan 18 14:03:29 CET 2013
On Fri, Jan 18, 2013 at 3:25 AM, Lie Ryan <lie.1296 at gmail.com> wrote:
> On 18/01/13 17:11, Gayathri S wrote:
>>
>> >>> import numpy as np
>> >>> import matplotlib.pyplot as plt
>> >>> import mlpy
>> >>> np.random.seed(0)
>> >>> mean,cov,n=[0,0],[[1,1],[1,1.5]],100
>> >>> x=np.random.multivariate_normal(mean,cov,n)
>> >>> pca.learn(x)
>> Traceback (most recent call last):
>> File "<interactive input>", line 1, in <module>
>> NameError: name 'pca' is not defined
>
> As in your particular problem, the basic issue is that you have not defined
> 'pca' to refer to any object. You need to create an object named pca, which
> in this particular case the object is probably an instance of mlpy.PCA,
> which can be constructed like this:
>
> pca = mlpy.PCA()
Yes, it's a mistake in the PCA example from the docs:
http://mlpy.sourceforge.net/docs/3.5/dim_red.html#principal-component-analysis-pca
More information about the Tutor
mailing list