Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.
Python
(2018-02-27)
Masahiro Sakai ( )
PYTHON
• Twitter: @masahiro_sakai
github: https://github.com/msakai/
G+: https://plus.google.com/+MasahiroSakai
• :
( )
• :
– ( H...
•
• Python
• Python
•
……
• Haskell
– Haskell ( )
• Ruby
–
( Python )
– Ruby-GNOME2
• Python
– Chainer + α
– PyPI
DISCLAIMER
•
Python
–
–
–
• Python
–
•
•
•
•
•
– R MATLAB
•
– numpy/scipy, pandas, scikit-learn, matplotlib, Jupyter
Notebook,
–
Python
• ……
Python
• ) numpy.array ==
– numpy …
– Python
⇒
– sorted([np.zeros(2), np.zeros(2)])
• ( collections-extended
R...
: ……
• ……
•
……
• ) pandas itertuples
type(next(pd.DataFrame({"x" + str(i): [i] for i in range(253)}).itertuples()))
#=> pa...
: Lisp-1
•
– Scheme, JavaScript
– Common Lisp, Ruby Lisp-2 ( )
•
Python Ruby
obj.foo(args) obj.foo(args)
( ) obj.foo() obj...
: Lisp-1
• ……
→
→
• Ruby Lisp-2
•
•
Python Ruby
obj.foo(…) obj.foo(…), obj.foo …
( ) obj.foo() obj.foo(), obj.foo
obj.foo ...
• (PEP 484)
• mypy
def greeting(name: str) -> str:
return 'Hello ' + name
print(greeting(0))
# => error: Argument 1 to "gr...
• Haskeller
–
–
•
– →
• Python Haskell
–
• List Tuple List
……
• (gradual typing)
– (dynamic typing) (static typing)
– Jeremy G. Siek and Walid Taha, Gradual Typing for Functional Langu...
(2)
•
– Python (mypy), TypeScript, Closure, Hack, Flow, C#?
–
• Python
–
• Python (mypy)
• ……
– (Any )
• e.g. Blame Calcul...
• :
• (np.array, chainer.Variable )
⇒
• shape
– shape
•
( : forward backward )
(1)
def __call__(self, x : np.array) -> np....
• shape Array(m,n,o)
……
– reshape
⇒ (c.f. )
– Haskell hmatrix API †
……
•
(2)
† https://hackage.haskell.org/package/hmatrix...
: Chainer
• Chainer
DSL
–
–
type_check.expect(in_types[0].shape == in_types[1].shape)
Expect: in_types[0].shape == in_type...
(3)
•
•
…
•
• CPython
• GPU CPU
– Python
……
– NN CPU
– GPU
……
numpy
• numpy
• numpy
( numpy )
– : x[np.arange(x.shape[0])[:, None], p]
–
•
•
( 1 540 2.1GB )
parsy-1.1.0 290m7.032s
pyparsing-2.2.0 562m41.623s
funcparserlib-0.3.6 79m45.315s
megaparsec-5.3.1 (Hask...
• :
–
–
……
• Cython
–
–
•
–
CPython
(Go )
• GIL (Global Interpreter Lock)
–
CPython
……
ONNX-Chainer ……
• Python
• Python
–
– Python
•
関数プログラマから見たPythonと機械学習
関数プログラマから見たPythonと機械学習
関数プログラマから見たPythonと機械学習
関数プログラマから見たPythonと機械学習
Prochain SlideShare
Chargement dans…5
×

関数プログラマから見たPythonと機械学習

28 893 vues

Publié le

2018-02-27に開催された 機械学習・ディープラーニングでPythonを使う嬉しさとツラミを分かちあう会 https://mlxse.connpass.com/event/77315/ での発表資料。

Publié dans : Ingénierie
  • DOWNLOAD THI5 BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici

関数プログラマから見たPythonと機械学習

  1. 1. Python (2018-02-27) Masahiro Sakai ( ) PYTHON
  2. 2. • Twitter: @masahiro_sakai github: https://github.com/msakai/ G+: https://plus.google.com/+MasahiroSakai • : ( ) • : – ( Haskell) – –
  3. 3. • • Python • Python • ……
  4. 4. • Haskell – Haskell ( ) • Ruby – ( Python ) – Ruby-GNOME2 • Python – Chainer + α – PyPI
  5. 5. DISCLAIMER • Python – – – • Python –
  6. 6. • • • •
  7. 7. • – R MATLAB • – numpy/scipy, pandas, scikit-learn, matplotlib, Jupyter Notebook, –
  8. 8. Python • …… Python • ) numpy.array == – numpy … – Python ⇒ – sorted([np.zeros(2), np.zeros(2)]) • ( collections-extended RangeMap )
  9. 9. : …… • …… • …… • ) pandas itertuples type(next(pd.DataFrame({"x" + str(i): [i] for i in range(253)}).itertuples())) #=> pandas.core.frame.Pandas type(next(pd.DataFrame({"x" + str(i): [i] for i in range(254)}).itertuples())) #=> tuple
  10. 10. : Lisp-1 • – Scheme, JavaScript – Common Lisp, Ruby Lisp-2 ( ) • Python Ruby obj.foo(args) obj.foo(args) ( ) obj.foo() obj.foo(), obj.foo obj.foo obj.method(:foo) m(args) m.call(args), m[args]
  11. 11. : Lisp-1 • …… → → • Ruby Lisp-2 • • Python Ruby obj.foo(…) obj.foo(…), obj.foo … ( ) obj.foo() obj.foo(), obj.foo obj.foo obj.method(:foo) m(…) m.call(…), m[…]
  12. 12. • (PEP 484) • mypy def greeting(name: str) -> str: return 'Hello ' + name print(greeting(0)) # => error: Argument 1 to "greeting" has incompatible type "int"; expected "str"
  13. 13. • Haskeller – – • – → • Python Haskell – • List Tuple List ……
  14. 14. • (gradual typing) – (dynamic typing) (static typing) – Jeremy G. Siek and Walid Taha, Gradual Typing for Functional Languages, in Proceedings of the 2006 Scheme and Functional Programming Workshop • – dynamic type: Any … Any – type consistency relation: A B • A = B Any ( : int→Any Any→str) – int ⊑ Any ⊑ str • (1)
  15. 15. (2) • – Python (mypy), TypeScript, Closure, Hack, Flow, C#? – • Python – • Python (mypy) • …… – (Any ) • e.g. Blame Calculus ( ) • Python (mypy)
  16. 16. • : • (np.array, chainer.Variable ) ⇒ • shape – shape • ( : forward backward ) (1) def __call__(self, x : np.array) -> np.array:
  17. 17. • shape Array(m,n,o) …… – reshape ⇒ (c.f. ) – Haskell hmatrix API † …… • (2) † https://hackage.haskell.org/package/hmatrix-0.18.2.0/docs/Numeric-LinearAlgebra-Static.html
  18. 18. : Chainer • Chainer DSL – – type_check.expect(in_types[0].shape == in_types[1].shape) Expect: in_types[0].shape == in_types[1].shape Actual: (3,) != (2,) http://blog.unnono.net/2015/10/chainer-typecheck.html
  19. 19. (3) • • … •
  20. 20. • CPython • GPU CPU – Python …… – NN CPU – GPU ……
  21. 21. numpy • numpy • numpy ( numpy ) – : x[np.arange(x.shape[0])[:, None], p] – •
  22. 22. • ( 1 540 2.1GB ) parsy-1.1.0 290m7.032s pyparsing-2.2.0 562m41.623s funcparserlib-0.3.6 79m45.315s megaparsec-5.3.1 (Haskell) 18m12.025s attoparsec-0.13.1.0 (Haskell) 15m46.415s : Python str Haskell ByteString(bytes )
  23. 23. • : – – …… • Cython – –
  24. 24. • – CPython (Go ) • GIL (Global Interpreter Lock) – CPython …… ONNX-Chainer ……
  25. 25. • Python • Python – – Python •

×