oooh scary
play

Oooh, scary! wren ng thornton wrnthorn@indiana.edu Cognitive - PowerPoint PPT Presentation

Monads Oooh, scary! wren ng thornton wrnthorn@indiana.edu Cognitive Science & Computational Linguistics Indiana University Bloomington wren ng thornton Probability Smoothing for NLP p. 1/7 Outline of the talk Categories


  1. Monads Oooh, scary! wren ng thornton wrnthorn@indiana.edu Cognitive Science & Computational Linguistics Indiana University Bloomington wren ng thornton Probability Smoothing for NLP – p. 1/7

  2. Outline of the talk • Categories • Functors • Monads wren ng thornton Probability Smoothing for NLP – p. 2/7

  3. Categories • Objects (e.g., types) ◦ Int , Bool , Int × Int , . . . • Morphisms (e.g., functions) ◦ f :Char → Int , . . . • Composition ◦ ∀ f : A → B . ∀ g : B → C . ∃ g ◦ f : A → C • Identity morphisms ◦ ∀ A . ∃ id A : A → A such that � ∀ f : A → B . f ◦ id A = f � ∀ f : B → A . id A ◦ f = f wren ng thornton Probability Smoothing for NLP – p. 3/7

  4. Functors • A map F : C → D from category C to category D ◦ Let’s assume C = D • F takes C -objects to D -objects ◦ data List A = Nil | Cons A ( List A ) ◦ data Maybe A = Nothing | Just A ◦ data Tree A = Tip A | Bin ( Tree A ) ( Tree A ) • F takes C -morphisms to D -morphisms ◦ map List : ( A → B ) → ( List A → List B ) ◦ map Maybe : ( A → B ) → ( Maybe A → Maybe B ) ◦ map Tree : ( A → B ) → ( Tree A → Tree B ) • And follows some laws ◦ ∀ A . F ( id A ) = id ( F A ) ◦ ∀ f . ∀ g . ( F f ) ◦ ( F g ) = F ( f ◦ g ) wren ng thornton Probability Smoothing for NLP – p. 4/7

  5. Monads • A functor T with some extra stuff • A “unit” natural transformation (aka pure , return , point ,. . . ) ◦ η :Id ˙ → T . . . What?! ◦ ∀ A . η A : A → T A . . . not quite ◦ η : ∀ A . A → T A • And a “join” natural transformation (or “bind” ( > =) instead) > ◦ µ : T ◦ T ˙ → T ◦ concat: ∀ A . List ( List A ) → List A • Following some laws ◦ µ A ◦ η A = id A ◦ µ A ◦ T η A = id A ◦ µ A ◦ T µ A = µ T A ◦ µ A wren ng thornton Probability Smoothing for NLP – p. 5/7

  6. Monads wren ng thornton Probability Smoothing for NLP – p. 6/7

  7. ∼ fin. wren ng thornton Probability Smoothing for NLP – p. 7/7

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend