[SciPy-user] mdp question

Noel O'Boyle noel.oboyle2 at mail.dcu.ie
Thu Sep 29 10:02:01 CDT 2005


For PLS, see pychem.sf.net. It's currently being converted to scipy, so
you should check out the CVS or post to the pychem mailing list if you
have any queries.

Noel

On Thu, 2005-09-29 at 16:49 +0200, Ramon Crehuet wrote:
> Hi all,
> I am using mdp to perform a PCA on some (dummy) variables. I can get the 
> principal components but I do not know how to get the "explained 
> variance" or change the number of output components. Here is my input:
> 
> import mdp
> from scipy import array
> x=array([[1.51, -2.10, 1.91],
>         [-2.10, 0.45, -1.25],
>         [1.59, -0.51, 0.50],
>         [0.45, -0.93, 1.51],
>         [0.04, -0.49,-0.09],
>         [-0.78, 1.89,-1.55],
>         [-0.62,0.00, -0.42]])
> pca=mdp.nodes.PCANode()
> pca.train(x)
> pca.stop_training()
> mat=pca.get_projmatrix()
> # works fine.
> x=pca.execute(x,1)
> #works fine, too.
> print pca.get_explained_variance()
> # This gives "None"
> pca.set_output_dim(1)
> # and this raises an exception:
> 
> Traceback (most recent call last):
>   File "/home/ramon/python/pca.py", line 21, in -toplevel-
>     pca.set_output_dim(1)
>   File "/usr/lib/python2.3/site-packages/mdp/nodes/pca_nodes.py", line 
> 32, in set_output_dim
>     raise TrainingFinishedException, errstr
> NameError: global name 'TrainingFinishedException' is not defined
> 
> 
> Could someone tell me what I am doing wrong?
> By the way, does anybody know of an implementation of the partial least 
> squares algorithm?
> Thanks for your help.
> 
> Ramon
> 
> 
> 
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user



More information about the SciPy-user mailing list