Numpy発表資料 tokyoscipy

2,588
-1

Published on

フィッシャーの線形判別ーフィッシャーのアヤメを例にー tokyoscipy

Published in: Technology, Economy & Finance
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,588
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
48
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Numpy発表資料 tokyoscipy

    1. 1. NUMPY- - gerumanium3_2
    2. 2. .....
    3. 3. https://gist.github.com/gerumanium
    4. 4. twitterID gerumanium3_2
    5. 5. numpy
    6. 6. (Pattern Recognition)
    7. 7. : :
    8. 8. Discriminant Analysisz Fisher (FDA) (discrimination) (classification) (LDA) (QDA)
    9. 9. 1. - 2.
    10. 10. fisher(1890 1962)
    11. 11. 1. W B −12. X =W B3. X λ4. L = l 1 x 1 + l 2 x 2 + l 3 x 3 + l4 x 4
    12. 12. x1: x2: x3: x4: L = l 1 x 1 + l 2 x 2 + l 3 x 3 + l4 x 4L ” L ” l1 , l2 , l3 , l4
    13. 13. K W = Sk L k=1 W T B Sk = (xn − mk )(xn − mk )T n∈Ck 1W: mk = xn Nk n∈Ck T: NB: T = (xn − mn )(xn − m)T m=1 T =W +B
    14. 14. L = l 1 x 1 + l 2 x 2 + l 3 x 3 + l4 x 4 l Bl Q≡ → max l Wl Ll’Bl l’Wl
    15. 15. Q L −1 X=W BX λ l1 , l2 , l3 , l4
    16. 16. 1. W B −12. X =W B linalg.inv()3. X λ linalg.eig()4. L = l 1 x 1 + l 2 x 2 + l 3 x 3 + l4 x 4
    17. 17. numpy
    18. 18. numpypythonnumpy“iris.txt”
    19. 19. >>from numpy import *>>data=loadtxt("iris.txt")>>
    20. 20. >>># >>>Vi=array([data[i] for i in range(0,50)]) >>>#Vi Vi.T transpose(Vi) >>>Vi=Vi.T >>>Vi=array([Vi[i] for i in range(1,5)]) >>>   x 1 x2 x = x1 , x2 , x3 , x4 , x5 →x=  x3  x4
    21. 21. >>#>>Ve=array([data[i] for i in range(50,100)])>>Ve=Ve.T>>Ve=array([Ve[i] for i in range(1,5)])>>>>#>>Se=array([data[i] for i in range(100,150)])>>Se=Se.T>>Se=array([Se[i] for i in range(1,5)])>>
    22. 22. >>> #>>> data=data.T>>> #(4,150)>>> data=array([data[i] for i in range(1,5)])>>>
    23. 23. 1. W B −12. X =W B linalg.inv()3. X λ linalg.eig()4. L = l 1 x 1 + l 2 x 2 + l 3 x 3 + l4 x 4
    24. 24. 1. W B
    25. 25. 3 W = Sk k=1= (V in − V¯i)(V in − V i)T ¯ n∈V i+ (V en − V¯e)(V en − V¯e)T n∈V e+ ¯ ¯ T (Sen − Se)(Sen − Se) n∈Se
    26. 26. >W=zeros((4,4))>#Vi>m1=array([[mean(i) for i in Vi]])>m1=m1.T>W+=dot(Vi-m1,transpose(Vi-m1)) (V in − V¯i)(V in − V i)T ¯n∈V i
    27. 27. #Ve>m2=array([[mean(i) for i in Ve]])>m2=m2.T>W+=dot(Ve-m2,transpose(Ve-m2))> (V en − V¯e)(V en − V¯e)T n∈V e
    28. 28. #Se>m3=array([[mean(i) for i in Se]])>m3=m3.T>W+=dot(Se-m3,transpose(Se-m3)) ¯ ¯ T (Sen − Se)(Sen − Se)n∈Se
    29. 29. T N TT = (xn − x)(xn − x) ¯ ¯ n=1 B=T−W
    30. 30. >>#>>M=array([[mean(i) for i indata]]).T>>T=dot(data-M,transpose(data-M))#>>B=T-W>>
    31. 31. 1. W B2. −1 linalg.inv() X=W B3. X λ linalg.eig()4. L = l 1 x 1 + l 2 x 2 + l 3 x 3 + l4 x 4
    32. 32. >># linalg.inv()>>X=dot(linalg.inv(W),B)>>
    33. 33. 1. W B −12. X =W B linalg.inv()3. X λ linalg.eig()4. L = l 1 x 1 + l 2 x 2 + l 3 x 3 + l4 x 4
    34. 34. >>>#>>>#la>>>#v la>>>la,v = linalg.eig(X)>>> laarray([3.21919292e+01,2.85391043e-01,3.25093377e-15, 3.08736744e-14])>>>
    35. 35. (1)L = −0.20874182x1 −0.38620369x2 +0.55401172x3 +0.7073504x4
    36. 36. L ( L(1) L(x) ) (2) (1)L = −0.20874182x1 L = −0.20874182x1 −0.38620369x2 −0.38620369x2 +0.55401172x3 +0.55401172x3 +0.7073504x4 +0.7073504x4
    37. 37. <http://d.hatena.ne.jp/ gerumanium/> ...
    38. 38. R5 (2009)(2007) (2008)
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×