skip to main content
10.1145/2489837.2489848acmotherconferencesArticle/Chapter ViewAbstractPublication PagesecoopConference Proceedingsconference-collections
research-article

What are the Odds?: probabilistic programming in Scala

Published:02 July 2013Publication History

ABSTRACT

Probabilistic programming is a powerful high-level paradigm for probabilistic modeling and inference. We present Odds, a small domain-specific language (DSL) for probabilistic programming, embedded in Scala. Odds provides first-class support for random variables and probabilistic choice, while reusing Scala's abstraction and modularity facilities for composing probabilistic computations and for executing deterministic program parts. Odds accurately represents possibly dependent random variables using a probability monad that models committed choice. This monadic representation of probabilistic models can be combined with a range of inference procedures. We present engines for exact inference, rejection sampling and importance sampling with look-ahead, but other types of solvers are conceivable as well. We evaluate Odds on several non-trivial probabilistic programs from the literature and we demonstrate how the basic probabilistic primitives can be used to build higher-level abstractions, such as rule-based logic programming facilities, using advanced Scala features.

References

  1. PyMC: Bayesian inference in Python. Online, 2012.Google ScholarGoogle Scholar
  2. K. J. Brown, A. K. Sujeeth, H. Lee, T. Rompf, H. Chafi, M. Odersky, and K. Olukotun. A heterogeneous parallel framework for domain-specific languages. PACT, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. M. Erwig and S. Kollmansberger. Functional pearls: Probabilistic functional programming in haskell. J. Funct. Program., 16(1):21--34, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. S. Fischer, O. Kiselyov, and C.-c. Shan. Purely functional lazy non-deterministic programming. In Proceedings of the 14th ACM SIGPLAN international conference on Functional programming, ICFP '09, pages 11--22, New York, NY, USA, 2009. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. J. Gibbons. Unifying theories of programming with monads. In Unifying Theories of Programming, volume 7681, pages 23--67. Springer, 2013.Google ScholarGoogle ScholarCross RefCross Ref
  6. N. D. Goodman, V. K. Mansinghka, D. M. Roy, K. Bonawitz, and J. B. Tenenbaum. Church: a language for generative models. In Proc. of Uncertainty in Artificial Intelligence, 2008.Google ScholarGoogle Scholar
  7. O. Kiselyov and C.-c. Shan. Embedded probabilistic programming. In W. M. Taha, editor, Domain-Specific Languages, volume 5658 of Lecture Notes in Computer Science, pages 360--384. Springer, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. H. Lee, K. J. Brown, A. K. Sujeeth, H. Chafi, T. Rompf, M. Odersky, and K. Olukotun. Implementing domain-specific languages for heterogeneous parallel computing. IEEE Micro, 31(5):42--53, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. D. J. Lunn, A. Thomas, N. Best, and D. Spiegelhalter. WinBUGS - A Bayesian modelling framework: Concepts, structure, and extensibility. Statistics and Computing, 10(4):325--337, Oct. 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. A. McCallum, K. Schultz, and S. Singh. Factorie: Probabilistic programming via imperatively defined factor graphs. In Adv. in Neural Inform. Processing Syst., volume 22, 2009.Google ScholarGoogle Scholar
  11. B. Milch, B. Marthi, S. Russell, D. Sontag, D. L. Ong, and A. Kolobov. BLOG: Probabilistic models with unknown objects. In L. Getoor and B. Taskar, editors, Statistical Relational Learning. MIT Press, 2007.Google ScholarGoogle Scholar
  12. B. Milch and S. Russell. General-purpose MCMC inference over relational structures. In Proc. 22nd Conference on Uncertainty in Artificial Intelligence, pages 349--358, 2006.Google ScholarGoogle Scholar
  13. T. Minka, J. Winn, J. Guiver, and D. Knowles. Infer.NET 2.5, 2012. Microsoft Research Cambridge. http://research.microsoft.com/infernet.Google ScholarGoogle Scholar
  14. A. Pfeffer. A general importance sampling algorithm for probabilistic programs. Tech. Rep. TR-12-07. Technical report, Harvard University, 2009.Google ScholarGoogle Scholar
  15. A. Pfeffer. Creating and manipulating probabilistic programs in figaro. UAI Workshop on Statistical Relational AI (StarAI), 2012.Google ScholarGoogle Scholar
  16. N. Ramsey and A. Pfeffer. Stochastic lambda calculus and monads of probability distributions. Proc. of the 29th ACM SIGPLAN-SIGACT Symp. on Principles of Program. Lang., pages 154--165, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. T. Rompf, N. Amin, A. Moors, P. Haller, and M. Odersky. Scala-virtualized: Linguistic reuse for deep embeddings. In Higher-Order and Symbolic Computation (Special issue for PEPM'12, to appear).Google ScholarGoogle Scholar
  18. T. Rompf and M. Odersky. Lightweight modular staging: a pragmatic approach to runtime code generation and compiled dsls. Commun. ACM, 55(6):121--130, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. T. Rompf, A. K. Sujeeth, H. Lee, K. J. Brown, H. Chafi, M. Odersky, and K. Olukotun. Building-blocks for performance oriented DSLs. DSL, 2011.Google ScholarGoogle ScholarCross RefCross Ref
  20. T. Sato. Generative modeling by prism. In ICLP, pages 24--35, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. A. K. Sujeeth, H. Lee, K. J. Brown, T. Rompf, M. Wu, A. R. Atreya, M. Odersky, and K. Olukotun. OptiML: an implicitly parallel domain-specific language for machine learning. In Proceedings of the 28th International Conference on Machine Learning, ICML, 2011.Google ScholarGoogle Scholar

Index Terms

  1. What are the Odds?: probabilistic programming in Scala

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in
    • Published in

      cover image ACM Other conferences
      SCALA '13: Proceedings of the 4th Workshop on Scala
      July 2013
      84 pages
      ISBN:9781450320641
      DOI:10.1145/2489837

      Copyright © 2013 ACM

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 2 July 2013

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      SCALA '13 Paper Acceptance Rate12of22submissions,55%Overall Acceptance Rate12of22submissions,55%

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader