On Thu, Jan 17, 2013 at 10:11 PM, Gayathri S <gayathri.s...@gmail.com>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 > >>> > would you please help me in finding the error...? what was my fault? how > could i use PCA in python..? > > The error means exactly what it says: you've referred to "pca", but you haven't told Python what "pca" is. I don't know the actual name of the PCA module you're using, but you need to import it the same way you've imported the other packages: - if it's called simply "pca", then just write "import pca" - if it has some other, slightly longer name, and you want to shorten it (as you did with "numpy", shortening it to "np"), then: "import longPCAname as pca"
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor