Deployable Probabilistic Programming

Total Page:16

File Type:pdf, Size:1020Kb

Deployable Probabilistic Programming Deployable Probabilistic Programming David Tolpin PUB+ Israel [email protected] Abstract There are two polar views on the role of probabilistic pro- We propose design guidelines for a probabilistic program- gramming. One view is that probabilistic programming is ming facility suitable for deployment as a part of a produc- a flexible framework for specification and analysis of sta- tion software system. As a reference implementation, we in- tistical models [11, 51, 59]. Proponents of this view per- troduce Infergo, a probabilistic programming facility for Go, ceive probabilistic programming as a tool for data science a modern programming language of choice for server-side practitioners. A typical workflow consists of data acquisi- software development. We argue that a similar probabilistic tion and pre-processing, followed by several iterations of ex- programming facility can be added to most modern general- ploratory model design and testing of inference algorithms. purpose programming languages. Once a sufficiently robust statistical model is obtained, anal- Probabilistic programming enables automatic tuning of ysis results are post-processed, visualized, and occasionally program parameters and algorithmic decision making through integrated into algorithms of a production software system. probabilistic inference based on the data. To facilitate addi- The other, emerging, view is that probabilistic program- tion of probabilistic programming capabilities to other pro- ming is an extension of a regular programming toolbox gramming languages, we share implementation choices and allowing algorithms implemented in general-purpose pro- techniques employed in development of Infergo. We illus- gramming languages to have learnable parameters. In this trate applicability of Infergo to various use cases on case view, statistical models are integrated into the software sys- studies, and evaluate Infergo’s performance on several bench- tem, and inference and optimization take place during data marks, comparing Infergo to dedicated inference-centric prob- processing, prediction, and algorithmic decision making abilistic programming frameworks. in production. Probabilistic programming code runs unat- tended, and inference results are an integral part of the algo- ACM Reference Format: rithms. Natural applications arise whenever the algorithm is David Tolpin. 2019. Deployable Probabilistic Programming. In Pro- a generative model of a mental or physical process, in par- ceedings of SPLASH Onward! 2019 (Onward! 2019). ACM, New York, ticular when latent variables of the algorithm are used for NY, USA, 16 pages. hps://doi.org/10.1145/nnnnnnn.nnnnnnn decision making [15, 61]; for example, inference about user behavior in social networks, ongoing health monitoring, or 1 Introduction online motion planning of autonomous robotic devices. Probabilistic programming [13, 14, 26, 62] represents statis- In this work we are concerned with the later view on prob- tical models as programs written in an otherwise general abilistic programming. Our objective is to pave a path to de- programming language that provides syntax for the defini- ployment of probabilistic programs in production systems, arXiv:1906.11199v1 [cs.PL] 20 Jun 2019 tion and conditioning of random variables. Inference can promoting a wider adoption of probabilistic programming be performed on probabilistic programs to obtain the pos- as a flexible tool for ubiquitous statistical inference. Most terior distribution or point estimates of the variables. In- probabilistic programming frameworks are suited, to a cer- ference algorithms are provided by the probabilistic pro- tain extent, to be used in either the exploratory or the pro- gramming framework, and each algorithm is usually appli- duction scenario. However, the proliferation of probabilis- 1 cable to a wide class of probabilistic programs in a black-box tic programming languages and frameworks on one hand, manner. The algorithms include Metropolis-Hastings[26, 59, and scarcity of success stories about production use of prob- 63], Hamiltonian Monte Carlo [10], expectation propaga- abilistic programming on the other hand, suggest that there tion [29], extensions of Sequential Monte Carlo [33, 38, 55, is a need for new ideas and approaches to make probabilistic 62], variational inference [23, 60], gradient-based optimiza- programming models available for production use. tion [7, 10], and others. 1There are 45 probabilistic programming languages listed on Wikipedia [58]. 18 probabilistic programming languages were pre- Onward! 2019, October 20-25, 2019, Athens, Greece sented during the developer meetup at PROBPROG’2018, the inaugural 2019. ACM ISBN 978-x-xxxx-xxxx-x/YY/MM...$15.00 conference on probabilistic programming, hp://probprog.cc/, half of hps://doi.org/10.1145/nnnnnnn.nnnnnnn which are not on the Wikipedia list. Onward! 2019, October 20-25, 2019, Athens, Greece David Tolpin Our attitude differs from the established approach in that different semantics [16, 46] than a ‘regular’ program of sim- instead of proposing yet another probabilistic programming ilar structure. Goodman and Stuhlmüller [14] offer a sys- language, either genuinely different [10, 28] or derived from tematic approach to design and implementation of proba- an existing general-purpose programming language by ex- bilistic programming languages based on extension of the tending the syntax or changing the semantics [11, 13, 51], syntax of a (subset of) general-purpose programming lan- we advocate enabling probabilistic inference on models guage and transformational compilation to continuation- written in a general-purpose probabilistic programming lan- passing style [2, 3]. van de Meent et al. [54] give a com- guage, the same one as the language used to program the prehensive overview of available choices of design and im- bulk of the system. We formulate guidelines for such imple- plementation of first-order and higher-order probabilistic mentation, and, based on the guidelines, introduce a prob- programming languages. Stan [10] is built around an im- abilistic programming facility for the Go programming lan- perative probabilistic programming language with program guage [50]. By explaining our implementation choices and structure tuned for most efficient execution of inference on techniques, we argue that a similar facility can be added the model. SlicStan [17] is built on top of Stan as a source- to any modern general-purpose purpose programming lan- to-source compiler, providing the model developer with a guage, giving a production system modeling and inference more intuitive language while retaining performance ben- capabilities which do not fall short from and sometimes efits of Stan. Our work differs from existing approaches in exceed those of probabilistic programming-centric frame- that we advocate enabling probabilistic programming in a works with custom languages and runtimes. Availability of general-purpose programming language by leveraging ex- such facilities in major general-purpose programming lan- isting capabilities of the language, rather than building a guages would free probabilistic programming researchers new language on top or besides an existing one. and practitioners alike from language wars [48] and foster The need for integration between probabilistic programs practical applications of probabilistic programming. and the surrounding software environment is well under- stood in the literature [7, 51]. Probabilistic programming Contributions languages are often implemented as embedded domain- This work brings the following major contributions: specific languages [11, 42, 51] and include a mechanism of calling functions from libraries of the host languages. Our • Guidelines for design and implementation of a proba- work goes a step further in this direction: since the language bilistic programming facility deployable as a part of a of implementation of probabilistic models coincides with production software system. the host language, any library or user-defined function of • A reference implementation of deployable probabilis- the host language can be directly called from the probabilis- tic programming facility for the Go programming lan- tic model, and model methods can be directly called from guage. the host language. • Implementation highlights outlining important Automatic differentiation is widely employed in machine choices we made in implementation of the proba- learning [5, 56] where it is also known as ‘differentiable bilistic programming facility, and providing a basis programming’, and is responsible for enabling efficient in- for implementation of a similar facility for other ference in many probabilistic programming frameworks [7, general-purpose programming languages. 10, 11, 21, 52]. Different automatic differentiation tech- 2 Related Work niques [18] allow different compromises between flexibil- ity, efficiency, and feature-richness [21, 34, 44]. Automatic Our work is related to three interconnected areas of re- differentiation is usually implemented through either op- search: erator overloading [10, 11, 34] or source code transforma- 1. Design and implementation of probabilistic program- tion [21, 57]. Our work, too, relies on automatic differentia- ming languages. tion, implemented as source code transformation. However, 2. Integration and interoperability between probabilistic a novelty of our approach is that instead of using explicit programming models and the surrounding software calls or directives to denote parts of code which need to
Recommended publications
  • University of North Carolina at Charlotte Belk College of Business
    University of North Carolina at Charlotte Belk College of Business BPHD 8220 Financial Bayesian Analysis Fall 2019 Course Time: Tuesday 12:20 - 3:05 pm Location: Friday Building 207 Professor: Dr. Yufeng Han Office Location: Friday Building 340A Telephone: (704) 687-8773 E-mail: [email protected] Office Hours: by appointment Textbook: Introduction to Bayesian Econometrics, 2nd Edition, by Edward Greenberg (required) An Introduction to Bayesian Inference in Econometrics, 1st Edition, by Arnold Zellner Doing Bayesian Data Analysis: A Tutorial with R, JAGS, and Stan, 2nd Edition, by Joseph M. Hilbe, de Souza, Rafael S., Emille E. O. Ishida Bayesian Analysis with Python: Introduction to statistical modeling and probabilistic programming using PyMC3 and ArviZ, 2nd Edition, by Osvaldo Martin The Oxford Handbook of Bayesian Econometrics, 1st Edition, by John Geweke Topics: 1. Principles of Bayesian Analysis 2. Simulation 3. Linear Regression Models 4. Multivariate Regression Models 5. Time-Series Models 6. State-Space Models 7. Volatility Models Page | 1 8. Endogeneity Models Software: 1. Stan 2. Edward 3. JAGS 4. BUGS & MultiBUGS 5. Python Modules: PyMC & ArviZ 6. R, STATA, SAS, Matlab, etc. Course Assessment: Homework assignments, paper presentation, and replication (or project). Grading: Homework: 30% Paper presentation: 40% Replication (project): 30% Selected Papers: Vasicek, O. A. (1973), A Note on Using Cross-Sectional Information in Bayesian Estimation of Security Betas. Journal of Finance, 28: 1233-1239. doi:10.1111/j.1540- 6261.1973.tb01452.x Shanken, J. (1987). A Bayesian approach to testing portfolio efficiency. Journal of Financial Economics, 19(2), 195–215. https://doi.org/10.1016/0304-405X(87)90002-X Guofu, C., & Harvey, R.
    [Show full text]
  • Acme: a User Interface for Programmers Rob Pike [email protected]−Labs.Com
    Acme: A User Interface for Programmers Rob Pike [email protected]−labs.com ABSTRACT A hybrid of window system, shell, and editor, Acme gives text-oriented applications a clean, expressive, and consistent style of interaction. Tradi­ tional window systems support interactive client programs and offer libraries of pre-defined operations such as pop-up menus and buttons to promote a consistent user interface among the clients. Acme instead pro­ vides its clients with a fixed user interface and simple conventions to encourage its uniform use. Clients access the facilities of Acme through a file system interface; Acme is in part a file server that exports device-like files that may be manipulated to access and control the contents of its win­ dows. Written in a concurrent programming language, Acme is structured as a set of communicating processes that neatly subdivide the various aspects of its tasks: display management, input, file server, and so on. Acme attaches distinct functions to the three mouse buttons: the left selects text; the middle executes textual commands; and the right com­ bines context search and file opening functions to integrate the various applications and files in the system. Acme works well enough to have developed a community that uses it exclusively. Although Acme discourages the traditional style of interaction based on typescript windowsߞteletypesߞits users find Acmeߣs other ser­ vices render typescripts obsolete. History and motivation The usual typescript style of interaction with Unix and its relatives is an old one. The typescriptߞan intermingling of textual commands and their outputߞoriginates with the scrolls of paper on teletypes.
    [Show full text]
  • Tiny Tools Gerard J
    Tiny Tools Gerard J. Holzmann Jet Propulsion Laboratory, California Institute of Technology Many programmers like the convenience of integrated development environments (IDEs) when developing code. The best examples are Microsoft’s Visual Studio for Windows and Eclipse for Unix-like systems, which have both been around for many years. You get all the features you need to build and debug software, and lots of other things that you will probably never realize are also there. You can use all these features without having to know very much about what goes on behind the screen. And there’s the rub. If you’re like me, you want to know precisely what goes on behind the screen, and you want to be able to control every bit of it. The IDEs can sometimes feel as if they are taking over every last corner of your computer, leaving you wondering how much bigger your machine would have to be to make things run a little more smoothly. So what follows is for those of us who don’t use IDEs. It’s for the bare metal programmers, who prefer to write code using their own screen editor, and who do everything else with command-line tools. There are no real conveniences that you need to give up to work this way, but what you gain is a better understanding your development environment, and the control to change, extend, or improve it whenever you find better ways to do things. Bare Metal Programming Many developers who write embedded software work in precisely this way.
    [Show full text]
  • Sequence Alignment/Map Format Specification
    Sequence Alignment/Map Format Specification The SAM/BAM Format Specification Working Group 3 Jun 2021 The master version of this document can be found at https://github.com/samtools/hts-specs. This printing is version 53752fa from that repository, last modified on the date shown above. 1 The SAM Format Specification SAM stands for Sequence Alignment/Map format. It is a TAB-delimited text format consisting of a header section, which is optional, and an alignment section. If present, the header must be prior to the alignments. Header lines start with `@', while alignment lines do not. Each alignment line has 11 mandatory fields for essential alignment information such as mapping position, and variable number of optional fields for flexible or aligner specific information. This specification is for version 1.6 of the SAM and BAM formats. Each SAM and BAMfilemay optionally specify the version being used via the @HD VN tag. For full version history see Appendix B. Unless explicitly specified elsewhere, all fields are encoded using 7-bit US-ASCII 1 in using the POSIX / C locale. Regular expressions listed use the POSIX / IEEE Std 1003.1 extended syntax. 1.1 An example Suppose we have the following alignment with bases in lowercase clipped from the alignment. Read r001/1 and r001/2 constitute a read pair; r003 is a chimeric read; r004 represents a split alignment. Coor 12345678901234 5678901234567890123456789012345 ref AGCATGTTAGATAA**GATAGCTGTGCTAGTAGGCAGTCAGCGCCAT +r001/1 TTAGATAAAGGATA*CTG +r002 aaaAGATAA*GGATA +r003 gcctaAGCTAA +r004 ATAGCT..............TCAGC -r003 ttagctTAGGC -r001/2 CAGCGGCAT The corresponding SAM format is:2 1Charset ANSI X3.4-1968 as defined in RFC1345.
    [Show full text]
  • An Introduction to Data Analysis Using the Pymc3 Probabilistic Programming Framework: a Case Study with Gaussian Mixture Modeling
    An introduction to data analysis using the PyMC3 probabilistic programming framework: A case study with Gaussian Mixture Modeling Shi Xian Liewa, Mohsen Afrasiabia, and Joseph L. Austerweila aDepartment of Psychology, University of Wisconsin-Madison, Madison, WI, USA August 28, 2019 Author Note Correspondence concerning this article should be addressed to: Shi Xian Liew, 1202 West Johnson Street, Madison, WI 53706. E-mail: [email protected]. This work was funded by a Vilas Life Cycle Professorship and the VCRGE at University of Wisconsin-Madison with funding from the WARF 1 RUNNING HEAD: Introduction to PyMC3 with Gaussian Mixture Models 2 Abstract Recent developments in modern probabilistic programming have offered users many practical tools of Bayesian data analysis. However, the adoption of such techniques by the general psychology community is still fairly limited. This tutorial aims to provide non-technicians with an accessible guide to PyMC3, a robust probabilistic programming language that allows for straightforward Bayesian data analysis. We focus on a series of increasingly complex Gaussian mixture models – building up from fitting basic univariate models to more complex multivariate models fit to real-world data. We also explore how PyMC3 can be configured to obtain significant increases in computational speed by taking advantage of a machine’s GPU, in addition to the conditions under which such acceleration can be expected. All example analyses are detailed with step-by-step instructions and corresponding Python code. Keywords: probabilistic programming; Bayesian data analysis; Markov chain Monte Carlo; computational modeling; Gaussian mixture modeling RUNNING HEAD: Introduction to PyMC3 with Gaussian Mixture Models 3 1 Introduction Over the last decade, there has been a shift in the norms of what counts as rigorous research in psychological science.
    [Show full text]
  • Revenues 1010 1020 1030 1040 1045 1060 1090 82,958 139,250
    FCC Paper Report 43-01 ARMIS Annual Summary Report COMPANY Northern New England Telephone Telephone Operallons LLC ST UDY AREA. New Hempsh1 re PERIOD From: Jan 201 1 To Dec 2011 COSA FPNH A ACCOUNT LEVEL REPORTING (Dollars on thousands) ROW CLASSIFICATION T otal Nonreg AdJu stments Subject To Slate Interstate (a) (b) (C) (d) Separations (g) (h) (f) Revenues 1010 Besoc Local Servoces 82,958 N/A 0 82,958 82,958 0 1020 Network Access Services 139,250 N/A 0 139,250 9,443 129,807 1030 Toil Network Servoces 13,911 N/A 0 13,911 13,881 31 1040 Mosceltaneous 33,250 N/A 0 33,250 22,165 11,084 1045 Nonregutated 7,540 7,540 N/A N/A N/A N/A 1060 Uncoltecllbles 3,597 101 0 3,497 1,615 1,882 1090 Total Operalong Revenues 273,312 7,439 0 265,872 126,832 139,040 Imputation or Dtrectory Revenue 23,300 Total Assessed Revenue 296,612 Assessment 942,999 403,229 Assessment Factor $0.00318 $ 0.0031 8 The revenue data above os avaolable on the FCC ARMIS websote at http)/fjallrossJcc.gov/eafs7/adhoc/table year tal Profile and Historic Information! AT&T Labs! AT&T Page 1 of 5 Personal Business About AT&T ·~ ~ at&t Backgrounder In today's rapidly changing business environment, many of the most exciting innovations are being spearheaded by AT&T Labs, the long-respected research and development arm of AT&T. History The year was 1901...the beginning of a new century.
    [Show full text]
  • Sam Quick Reference Card
    Sam______________________ quick reference card ___________________________Addresses _Sam_______________________________________________________________________ idioms n,m line n to line m X/.*/,x/<cr>/d strip <cr> from all files ’ address mark, see k below x/ˆ/ .,/0d strip C comments from selection . correct selection/position -/ˆ/+#10 goto the 10th colum in the current line 0 start of file -0+,+0- round dot down to whole lines only ˆ start of line ,x/ +/ v/ˆ/ c/ / compress runs of spaces, leaving indentation $ end of line/file s/"([ˆ"]*)"/‘‘1’’/ replace "hello" with ‘‘hello’’ in selection , equivalent to 0,$ f <nl> set current file-name to null < echo "" insert ascii code xxx at current pos ______________________________Regular Expressions , > wc -l count lines in file . any character /text/+-p highlight the lines containing <pat> -/text/ search for text backwards * 0 or more of previous $-/text/ search for the last occurrence of text in file + 1 or more of previous [ˆn] any char but n ,x/<text>/+-p grep for text [nm] n or m .x/<pat>/ c/<rep>/ search for <pat> and replace with <rep> [a-z] class a thru z B < echo *.c add all the C files in current dir to file list B < grep -l <pat> * add all the files containing <pat> to file list (re) tag pattern # substitute #’th tagged pattern X/’/w write all modified files Y/.c/D remove all non C files from file list _Text________________________________________ commands fmt pipe selection through the text formatter > mail <user> send selection as Email
    [Show full text]
  • Is Structure Based Drug Design Ready for Selectivity Optimization?
    bioRxiv preprint doi: https://doi.org/10.1101/2020.07.02.185132; this version posted July 3, 2020. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. PrEPRINT AHEAD OF SUBMISSION — July 2, 2020 1 IS STRUCTURE BASED DRUG DESIGN READY FOR 2 SELECTIVITY optimization? 1,2,† 2 3 4 4 3 SteVEN K. Albanese , John D. ChoderA , AndrEA VOLKAMER , Simon Keng , Robert Abel , 4* 4 Lingle WANG Louis V. Gerstner, Jr. GrADUATE School OF Biomedical Sciences, Memorial Sloan Kettering Cancer 5 1 Center, NeW York, NY 10065; Computational AND Systems Biology PrOGRam, Sloan Kettering 6 2 Institute, Memorial Sloan Kettering Cancer Center, NeW York, NY 10065; Charité – 7 3 Universitätsmedizin Berlin, Charitéplatz 1, 10117 Berlin; Schrödinger, NeW York, NY 10036 8 4 [email protected] (LW) 9 *For CORRespondence: †Schrödinger, NeW York, NY 10036 10 PrESENT ADDRess: 11 12 AbstrACT 13 Alchemical FREE ENERGY CALCULATIONS ARE NOW WIDELY USED TO DRIVE OR MAINTAIN POTENCY IN SMALL MOLECULE LEAD 14 OPTIMIZATION WITH A ROUGHLY 1 Kcal/mol ACCURACY. Despite this, THE POTENTIAL TO USE FREE ENERGY CALCULATIONS 15 TO DRIVE OPTIMIZATION OF COMPOUND SELECTIVITY AMONG TWO SIMILAR TARGETS HAS BEEN RELATIVELY UNEXPLORED IN 16 PUBLISHED studies. IN THE MOST OPTIMISTIC scenario, THE SIMILARITY OF BINDING SITES MIGHT LEAD TO A FORTUITOUS 17 CANCELLATION OF ERRORS AND ALLOW SELECTIVITY TO BE PREDICTED MORE ACCURATELY THAN AffiNITY. Here, WE ASSESS 18 THE ACCURACY WITH WHICH SELECTIVITY CAN BE PREDICTED IN THE CONTEXT OF SMALL MOLECULE KINASE inhibitors, 19 CONSIDERING THE VERY SIMILAR BINDING SITES OF HUMAN KINASES CDK2 AND CDK9, AS WELL AS ANOTHER SERIES OF 20 LIGANDS ATTEMPTING TO ACHIEVE SELECTIVITY BETWEEN THE MORE DISTANTLY RELATED KINASES CDK2 AND ERK2.
    [Show full text]
  • Computer Oral History Collection, 1969-1973, 1977
    Computer Oral History Collection, 1969-1973, 1977 Interviewee: B. Holbrook Interviewer: Uta C. Merzbach Date: May 10, 1969 Repository: Archives Center, National Museum of American History MERZBACH: Do you mind starting out by giving a little basic background as to your early interest, training, and schooling, how you came to go to Bell Labs. HOLBROOK: I was educated to be an X-ray physicist, and I came to Bell Laboratories in 1930 expecting to work in some branch of physics, and I have worked in almost everything except physics ever since. I was in transmission research for a good many years. I worked on voice-operated devices for transatlantic radio and things like this for awhile. Most of the War I spent in a group that was developing electrical analog anti aircraft fire control equipment for the Navy. And then I worked for several years in the Switching Research Department, and in 1957 became head of what was ultimately called the computing systems research department, where I was for the remaining eleven years at Bell Laboratories. I never had anything officially to do with computers until 1957. I was interested in what was going on and thereby acquired some knowledge of it. MERZBACH: Could you tell about the early activities which I guess were taking place just about the time that you came to the Labs? HOLBROOK: Well, of course, from the standpoint of the history of computers of the major advances was made in 1927 or 1938 with Harold Black's invention of the feedback amplifier which changed an amplifier from something which had gain into a precision measuring instrument which was the essential part of building an electric analog computer and was extremely convenient in handling signals through electronic digital computers.
    [Show full text]
  • Using the Go Programming Language in Practice
    MASTER’S THESIS | LUND UNIVERSITY 2014 Using the Go Programming Language in Practice Fredrik Pettersson, Erik Westrup Department of Computer Science Faculty of Engineering LTH ISSN 1650-2884 LU-CS-EX 2014-19 Using the Go Programming Language in Practice Erik Westrup Fredrik Pettersson <[email protected]> <[email protected]> <[email protected]> <[email protected]> June 5, 2014 Master’s thesis work carried out at Axis Communications AB for the Department of Computer Science, Lund University. Supervisors: Jonas Skeppstedt <[email protected]> Mathias Bruce <[email protected]> Robert Rosengren <[email protected]> Examiner Jonas Skeppstedt Abstract When developing software today, we still use old tools and ideas. Maybe it is time to start from scratch and try tools and languages that are more in line with how we actually want to develop software. The Go Programming Language was created at Google by a rather famous trio: Rob Pike, Ken Thompson and Robert Griesemer. Before introducing Go, the company suffered from their development process not scaling well due to slow builds, uncontrolled dependencies, hard to read code, poor documenta- tion and so on. Go is set out to provide a solution for these issues. The purpose of this master’s thesis was to review the current state of the language. This is not only a study of the language itself but an investigation of the whole software development process using Go. The study was carried out from an embedded development perspective which includes an investigation of compilers and cross-compilation. We found that Go is exciting, fun to use and fulfills what is promised in many cases.
    [Show full text]
  • Programming Languages
    Introduction to Programming Languages Introduction to Programming Languages Anthony A. Aaby © 1996 by Anthony A. Aaby HTML Style Guide | To Do | Miscellenous (possible content) | Figures | Definitions Short Table of Contents Preface 1. Introduction 2. Syntax 3. Semantics 4. Translation 5. Pragmatics 6. Abstraction and Generalization 7. Data and Data Structuring 8. Logic Programming 9. Functional Programming 10. Imperative Programming 11. Concurrent Programming 12. Object-Oriented Programming 13. Evaluation Appendix Stack machine Unified Grammar Logic Bibliography Definitions Index Supplementary Material http://cs.wwc.edu/~aabyan/221_2/PLBOOK/ (1 de 6) [18/12/2001 10:33:41] Introduction to Programming Languages Code Answers Long Table of Contents HTML Style Guide | To Do Preface Syntax, translation, semantics and pragmatics 1 Introduction 1.1 Data 1.2 Models of Computation 1.3 Syntax and Semantics 1.4 Pragmatics 1.5 Language Design Principles 1.6 Historical Perspectives and Further Reading 1.7 Exercises 2 Syntax 2.1 Context-free Grammars 2.1.1 Alphabets and Languages 2.1.2 Grammars and Languages 2.1.3 Abstract Syntax 2.1.4 Parsing 2.1.5 Table-driven and recursive descent parsing 2.2 Nondeterministic Pushdown Automata 2.2.1 Equivalence of pda and cfgs 2.3 Regular Expressions 2.4 Deterministic and Non-deterministic Finite State Machines 2.4.1 Equivalence of deterministic and non-deterministic fsa 2.4.2 Equivalence of fsa and regular expressions 2.4.3 Graphical Representation 2.4.4 Tabular Representation 2.4.5 Implementation of FSAs 2.5 Historical
    [Show full text]
  • Migrating MATLAB®To Python
    Migrating MATLAB® to Python Strategies, Comparisons and a Guide to Converting for Experts Migrating MATLAB® to Python Strategies, Comparisons and a Guide to Converting for Experts Alexandre Chabot-Leclerc Enthought, Inc. ©2020 Enthought, Inc. Written by Enthought, Inc. All Rights Reserved. Use only permitted under license. Copying, sharing, redistributing, or other unauthorized use strictly prohibited. All trademarks and registered trademarks are the property of their respective owners. MATLAB and Simulink are registered trademark of The MathWorks, Inc. Enthought, Inc. 200 W Cesar Chavez St Suite 202 Austin, TX 78701 United States www.enthought.com Version 1.2.0 Migrating MATLAB® to Python B Introduction 1 Why Python 2 Diff erences Between Python and MATLAB® 4 Fundamental Data Types 4 Organizing Code in Packages, not Toolboxes 6 Syntax 6 Indexing and Slicing: Why Zero-Based Indexing 8 NumPy Arrays Are Not Matrices 10 Programming Paradigm: Object-Oriented vs. Procedural 13 Anti-Patterns 15 How Do I? 17 Load Data 17 Signal Processing 19 Linear Algebra 19 Machine Learning 20 Statistical Analysis 21 Image Processing and Computer Vision 21 Optimization 22 Natural Language Processing 22 Data Visualization 22 Save Data 25 What Else? 26 Strategies for Converting to Python 27 From the Bottom Up: Converting One Function at a Time 27 From the Top Down: Calling Python from MATLAB® 33 What Next? 37 Acknowledgments 37 Appendix 37 Code Example: Profiling Contiguous Array Operations 37 Complete Version of main.py, in Chapter 4 38 References 39 Accelerate your Python migration with Enthought’s Python for Scientists and Engineers training course! Migrating MATLAB® to Python C Introduction This document will guide you through the transition from MATLAB® to Python.
    [Show full text]