What Does Probabilistic Programming Work?

  • Tanesh Balodi
  • Nov 09, 2021
  • Python Programming
What Does Probabilistic Programming Work? title banner

Probabilistic Programming


Probabilistic programming is a statistical modeling method where the idea is to apply what we've learned about programming languages to difficulties like constructing and deploying statistical models


Probabilistic programming is the process of performing statistics using computer science techniques. It's okay if your application uses rand(3) as part of the task it's supposed to do—for example, in a cryptographic key generator or an OS kernel's implementation of ASLR—but that's not the point of this discussion. 


The essential takeaway from Probabilistic Programming is that statistical modeling may start to seem like programming after a while. Many new tools become possible if we make the jump and utilize a true language for modeling. 


Working of Probabilistic Programming


Probabilistic programming is a type of programming that involves the use of probability. It may be used not just to forecast the future, but also to understand facts that lead to certain results; the program can be untangled to reveal the fundamental reasons for the outcomes. 


You may also use the software in one instance, learn from the results, and then use what you've learned in the future to make better predictions. Probabilistic programming may assist you in making any choice that can be informed by probabilistic reasoning. 


What is the mechanism behind it? So, once you've built-in inference methods in probabilistic programming systems, they'll immediately apply to your programs. 


All you have to do is give the data and submit your domain knowledge as a probabilistic program, and the system will handle the inference and learning for you. 


We may argue that probabilistic programming is motivated by the fact that it combines two notions that are both strong in their own right. As a result, using computers to assist in making judgments under ambiguity is now easier and more adaptable.


(Related blog: Working With Random Numbers in Python: Random Probability Distributions)


Applications of Probabilistic Programming


  • A useful computer vision demo is included in the web ppl book, which demonstrates how a generative "ahead" model may be used "backward" to tackle a different issue.


  • TrueSkill, which was first put out in this ESOP'11 article, is likely the most generally recognized example. It's the model that multiplayer Xbox games utilize to determine excellent player pairings. The goal is to use latent factors to estimate the player's abilities and match individuals so that the expected victory probability is close to 50/50.


  • Figuring out how to use standard programs to deal with probability There is a lot of common software that deals with probabilistic behavior: approximation computation, sensor interaction, and so on.


  • Forest is a bewildering collection of generative models developed in PPLs for fields ranging from cognition and natural language processing to document retrieval.


  • Turing.jl, a probabilistic programming framework, has recently been used in a number of pharmacological and economics applications.


(Must read: Conditional Probability: Definition, Properties and Examples)



What is PPL (Probabilistic Programming Language)?


A probabilistic programming language is a regular programming language that comes with the rand and a slew of other tools to assist you to analyse the statistical behavior of the program. 


Probabilistic Programming Languages (PPLs) are domain-specific languages that define probabilistic models and the mechanics for inferring from them. PPL's concept comes from merging probabilistic approaches' inference skills with programming languages' representational capacity. 


Prior distributions over the variables in the model are used to represent assumptions in a PPL program. A PPL program will run an inference technique to automatically determine the posterior distributions of the model's parameters based on observed data during execution. In other words, inference uses observed data to change the prior distribution and provide a more exact model. 


A probability distribution is the outcome of a PPL program, and it allows the programmer to openly view and alter the uncertainty associated with a result. However, probabilistic programming was limited in scope until recently (partly owing to insufficient processing capacity), and most inference methods had to be designed manually for each task. Several PPLs are currently in development, including several in beta tests. Stan and PyMC3 are the 2 most frequent tools. 


PRPL (probabilistic relational programming language) is a programming language designed primarily for expressing and inferring probabilistic relational models (PRMs). A PRM is often built using a collection of algorithms for reducing, inferring about, and discovering the distributions in question, which are incorporated in the associated PRPL.


Recently, the two schools of thinking have merged to create single algorithms that incorporate deep learning and Bayesian modeling. Deep probabilistic programming languages are the culmination of this endeavor (Deep PPLs). 


Bayesian neural networks with probabilistic weights and biases may be expressed using deep PPLs. Deep PPLs have manifested in the form of new probabilistic languages and libraries that interact smoothly with popular deep learning frameworks


The subject of probabilistic programming languages (PPLs) has erupted with research and innovation in recent years. The majority of these breakthroughs have come from combining Probability Programming Languages with deep learning approaches to create neural networks that can perform complex tasks. 


Deep Probabilistic Programming Language (PPLs)  have been pushed to their limits in large-scale settings by companies such as Google, Microsoft, and Uber. These efforts have resulted in whole new Deep PPLs stacks, which are gaining in popularity among machine learning researchers. Deep PPL is rapidly establishing itself as a critical component of the machine learning ecosystem.  


PPLs are projected to be pushed to their limits in the near future due to the confluence of deep learning frameworks and PPLs, which allows a tremendous amount of opportunity for innovation. 


(Related reading: Introduction to Deep Learning)


Latest developments in the Deep PPL


  • Pyro: Uber AI Labs published Pyro, a deep probabilistic programming language (PPL). PyTorch is the foundation for Pyro.


  • Edward: It is a probabilistic programming language built-in Python that is Turing-complete. The Google Brain team first championed Edward, but he now has a long list of supporters.


  • Infer.Net: Microsoft has released Infer.Net, a tool for .Net developers that makes probabilistic programming easier. Infer.Net has been under development at Microsoft Research since 2004, although the framework has just lately gained traction with the rise of deep learning.



About Probabilistic Reasoning Systems 


A probabilistic reasoning system has been used to aid decision-making in the face of uncertainty. To find those unseen aspects that are crucial to the choice, probabilistic reasoning integrates our understanding of a situation with the rules of probability. 


  • Probabilistic reasoning systems had a restricted scope and were difficult to apply to many real-world situations until recently. 

  • Probabilistic programming is a novel technique for building and deploying probabilistic reasoning systems. 

  • Probabilistic reasoning is a method of making judgments under uncertainty using a model of your domain. 


As more data is presented, a probabilistic reasoning system, like any machine learning models, will increase inaccuracy. The accuracy of the forecasts is determined by two factors: the original model's ability to properly portray real-world scenarios and the quantity of data you provide. 


As you add more details to the model, it becomes less relevant. This is the case because the new model is a compromise between the prior model and the data's information. 


(Suggested blog: Applications of Neural Networks)


When only a little amount of data is provided, the original model takes precedence, thus it must be correct. When you have a lot of data, the data takes precedence, and the new model tends to forget about the old model, which isn't as important.



To sum up, in this article, we have discussed the working of probabilistic programming and the probabilistic programming language(PPL). In the later section, we have discussed the latest advancements in PPL, which is Deep PPL that includes deep learning. In the final section, we got a quick overview of probabilistic reasoning systems.