[Tutor] Help- Regarding python

2013-02-03 Thread Gayathri S
Hi All!
If i have data set like this means...

3626,5000,2918,5000,2353,2334,2642,1730,1687,1695,1717,1744,593,502,493,504,449,431,444,444,429,10
438,498,3626,3629,5000,2918,5000,2640,2334,2639,1696,1687,1695,1717,1744,592,502,493,504,449,431,444,441,429,10
439,498,3626,3629,5000,2918,5000,2633,2334,2645,1705,1686,1694,1719,1744,589,502,493,504,446,431,444,444,430,10
440,5000,3627,3628,5000,2919,3028,2346,2330,2638,1727,1684,1692,1714,1745,588,501,492,504,451,433,446,444,432,10
444,5021,3631,3634,5000,2919,5000,2626,2327,2638,1698,1680,1688,1709,1740,595,500,491,503,453,436,448,444,436,10
451,5025,3635,3639,5000,2920,3027,2620,2323,2632,1706,1673,1681,1703,753,595,499,491,502,457,440,453,454,442,20
458,5022,3640,3644,5000,2922,5000,2346,2321,2628,1688,1666,1674,1696,744,590,496.

How to do PCA on this data? if it is in array how to do that? and also how
to use princomp() in PCA?

Shall i use the following code for doing PCA on given input? could you tell
me?

from numpy import mean,cov,double,cumsum,dot,linalg,array,rank
from pylab import plot,subplot,axis,stem,show,figure
A = array([ [2.4,0.7,2.9,2.2,3.0,2.7,1.6,1.1,1.6,0.9],
[2.5,0.5,2.2,1.9,3.1,2.3,2,1,1.5,1.1] ])
M = (A-mean(A.T,axis=1)).T[latent,coeff] = linalg.eig(cov(M))
score = dot(coeff.T,M)
return coeff,score,latent
princomp(A):
coeff, score, latent = princomp(A.T)
figure()
subplot(121)
m = mean(A,axis=1)
plot([0, -coeff[0,0]*2]+m[0], [0, -coeff[0,1]*2]+m[1],'--k')
plot([0, coeff[1,0]*2]+m[0], [0, coeff[1,1]*2]+m[1],'--k')
plot(A[0,:],A[1,:],'ob') # the data
axis('equal')
subplot(122)
plot(score[0,:],score[1,:],'*g')
axis('equal')
plt.show()

 Thanks!

  Regards,

   Gayathri.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP- Regarding working with python

2013-01-29 Thread Gayathri S
Hi all...!
I don't know how to import our own data sets in python. its
always importing the in built data sets. could you just tell me how to do
that...!


Thanks...!

On Mon, Jan 28, 2013 at 1:50 PM, Steven D'Aprano st...@pearwood.infowrote:

 On 28/01/13 18:26, Gayathri S wrote:

 Hi all..!
 wanna know how to compile python script in python command
 line,
 and is there any need for setting path for python like JAVA? whats the
 difference between .py file and .pyc file?



 Python is a byte-code compiled language, like Java many years ago.
 Normally to compile a python module, you just import it from within Python.

 That is not very convenient for scripts, so from the shell (bash,
 command.com, cmd.exe, or similar) you can run

 python -m compileall NAME NAME ...

 to compile scripts.


 You do not necessarily need to set the PYTHONPATH, but you can if you need
 to.

 .py files are source code. .pyc are compiled byte code. .pyo are compiled
 byte code with optimization turned on. Don't get too excited, the standard
 Python optimization doesn't do very much.



 --
 Steven

 __**_
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/**mailman/listinfo/tutorhttp://mail.python.org/mailman/listinfo/tutor




-- 




Keep Smiling.
Regards
Gayu
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] HELP-Regarding python

2013-01-29 Thread Gayathri S
Hi All!
 I don't know how to read text file in python. If the data
values are stored in a text file format, for example(1,30,60,90,120...200)
means what i would do for reading it in python. could you just explain it.



Thanks!




Keep Smiling.[?]
Regards
Gayu[?]
335.png___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP- Regarding working with python

2013-01-27 Thread Gayathri S
Hi all..!
   wanna know how to compile python script in python command line,
and is there any need for setting path for python like JAVA? whats the
difference between .py file and .pyc file?
Thanks...!

On Sat, Jan 19, 2013 at 8:54 AM, bob gailer bgai...@gmail.com wrote:

 On 1/18/2013 8:03 AM, eryksun wrote:

 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-**pcahttp://mlpy.sourceforge.net/docs/3.5/dim_red.html#principal-component-analysis-pca

 There seems to be no way to report a bug in that documentation! Or am I
 missing something?

 --
 Bob Gailer
 919-636-4239
 Chapel Hill NC


 __**_
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/**mailman/listinfo/tutorhttp://mail.python.org/mailman/listinfo/tutor




-- 




Keep Smiling.
Regards
Gayu
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP- Regarding working with python

2013-01-17 Thread Gayathri S
hi...
  I am using principal component analysis for dimensionality
reduction in python. am having this following error...
 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..?

  Thanks.!

On Wed, Jan 9, 2013 at 12:58 PM, Gayathri S gayathri.s...@gmail.com wrote:

 Hi..
 I would like to use Principal component analysis independent
 component analysis in python. Wanna know whether it will support this
 efficiently or not?


 On Wed, Jan 2, 2013 at 4:59 PM, Alan Gauld alan.ga...@btinternet.comwrote:

 On 02/01/13 07:20, Gayathri S wrote:

 Hi..
   I am using python 2.7 and scikit-learn for machine learning.
 And OS is Windows 7. Wanna know how to import our own data sets  in
 scikit-learn?


 Further to my last mail there is a gmane group

 gmane.comp.python.scikit-learn

 I'd try looking there, or wherever it is sourced originally.



 --
 Alan G
 Author of the Learn to Program web site
 http://www.alan-g.me.uk/

 __**_
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/**mailman/listinfo/tutorhttp://mail.python.org/mailman/listinfo/tutor




 --




 Keep Smiling.
 Regards
 Gayu




-- 




Keep Smiling.
Regards
Gayu
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] HELP- Regarding working with python

2013-01-08 Thread Gayathri S
Hi..
I would like to use Principal component analysis independent
component analysis in python. Wanna know whether it will support this
efficiently or not?

On Wed, Jan 2, 2013 at 4:59 PM, Alan Gauld alan.ga...@btinternet.comwrote:

 On 02/01/13 07:20, Gayathri S wrote:

 Hi..
   I am using python 2.7 and scikit-learn for machine learning.
 And OS is Windows 7. Wanna know how to import our own data sets  in
 scikit-learn?


 Further to my last mail there is a gmane group

 gmane.comp.python.scikit-learn

 I'd try looking there, or wherever it is sourced originally.



 --
 Alan G
 Author of the Learn to Program web site
 http://www.alan-g.me.uk/

 __**_
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/**mailman/listinfo/tutorhttp://mail.python.org/mailman/listinfo/tutor




-- 




Keep Smiling.
Regards
Gayu
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] HELP- Regarding working with python

2013-01-01 Thread Gayathri S
Hi..
 I am using python 2.7 and scikit-learn for machine learning. And
OS is Windows 7. Wanna know how to import our own data sets  in
scikit-learn?



Regards,

Gayathri.S
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor