Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Causal Inference Engine in Kotlin

January 20, 2021

Causal Inference Engine in Kotlin

Causal Inference Engine based in the paper[1] and implemented in Koltin using Probability Trees.

According the paper, probability trees are one of the simplest models of causal generative processes. They possess clean semantics and -- unlike causal Bayesian networks -- they can represent context-specific causal dependencies, which are necessary for e.g. causal induction. Yet, they have received little attention from the AI and ML community.

[1] Algorithms for Causal Reasoning in Probability Trees
Genewein et al. (2020)


January 20, 2021

More Decks by almo

Other Decks in Programming


  1. 1. Schedule AI paradigm programmed in Kotlin ➔ Introduction almo,

    open source and community ➔ Kotlin AI Java developers’ dream of a better programming language. ➔ Curve fitting vs Strong AI Machines with the sense of humans: mind over data ➔ Causal Inference Engine Answering the simplest question: Why?
  2. A few words about me... Andres-Leonardo Martinez-Ortiz a.k.a almo is

    a member of the Google Engineering team, leading Google Developer Relations worldwide. Based in Zurich, he drives the success of Google's developer products and the Open Web by creating a thriving ecosystem of developers. Nurturing developers experts and partners in large companies, startups, universities and enterprises, almo fosters open standards and Google technologies. almo is also a member of IEEE, ACM, Linux Foundation and Computer Society. @davilagrau almo.dev almo
  3. Developers came together from all corners of the world to

    innovate, find connection, and solve problems*, using Internet and Open Source. *Octoverse 2020
  4. Why Kotlin? Easy learning curve Java interoperability Ecosystem support Educational

    resources: • Kotlin Koans Multi platform The language of Android and server side, web or native applications Academically recognized Popular in the industry Multi paradigm Concurrent programming including corrutines and CSP Object oriented Higher order functions and Lambda functions
  5. CSAT for computers, emperors and their new minds & Chinese

    rooms Thinking about intelligence: Philosophical foundations. Photo by K. Mitch Hodge on Unsplash
  6. Superintelligent AI May Be Impossible to Control. Not even possible

    to know if an AI is superintelligent. https://spectrum.ieee.org/tech-talk/robotics/artificial-intelligence/super-artificialintelligence January 2021
  7. Counterfactuals Activities: imagining, retrospective, understanding. What if I have done…

    ? Why? Was X the cause? Y? What if X has not occurred? What if I acted differently? Intervention Activities: doing, intervening. What if I do… ? How? What would Y be if I do X? How can I make Y happen? Association Activities: seeing, observing. What if I see…? How are the variables related? How would seeing X change my belief of Y? The Ladder of Causation
  8. Causal Inference Engine Knowledge Assumptions Causal Model Testable Implication Query

    Can we answer? Back to 2 and 3 Estimand (Recipe) Data Statistical Estimation Estimate (Answer) 1 2 3 4 5 7 8 9 6 Yes No Inference Engine
  9. Representing Knowledge in a Uncertain World Bayesian networks vs causality

    inference Mind over data “Causation is a language with which one can talk efficiently about certain structures of relevance relationships.” (1988) “The words embarrass me today ” (2018)
  10. Causal Inference in Probability Trees Algorithms for Causal Reasoning in

    Probability Trees Genewein et al. (2020) DeepMind https://arxiv.org/abs/1911.10500
  11. Definitions Algorithms for Causal Reasoning in Probability Trees Genewein et

    al. (2020) DeepMind https://arxiv.org/abs/2010.12237
  12. Probability Trees Recursive definition Node n is a tuple n

    = (u,S,C) • Id • Statements list • Transition list Transition list is a tuple (,) ∈ [0,1]xN • transition probability • Node m The root: • Node without parents • Statement “O=1” A leaf is a node with childs.
  13. Events and min-cuts An event is a collection of total

    realization i.e. path from the root to a leaf. Formally, an event is a cut δ(, ) where the true set and the false set contains all the nodes where the event becomes true and false respectively. Critical nodes are Markov Blanket: all variables bound within a path from the root to the critical nodes are exogenous downstream.
  14. Causal Events Precedence Bug: it should be e Bug: it

    should be e Note: the event where Y=1 precedes Z=0 cannot be stated logically. It is a causal event requiring a probability tree.
  15. Causal Events Conditions Bug: it should be q Question: What

    is the probability of the event A given that the event B is true? Note: Downstream (prediction) or upstream (inference)
  16. Causal Events Interventions Question: What is the probability of the

    event A given that the event B was made true? Note: only downstream (prediction)
  17. Initialization Root NodeID:01 Statement:[O,1] Transitions Statements:[(X, 0)] NodeID:01.0 P:0.4545 Statements:[(Y,

    0)] NodeID:01.0.0 P:0.4000 Statements:[(Z, 0)] NodeID: P:0.5000 Statements:[(Z, 1)] NodeID: P:0.5000 Statements:[(Y, 1)] NodeID:01.0.1 P:0.6000 Statements:[(Z, 1)] NodeID: P:0.3333 Statements:[(Z, 0)] NodeID: P:0.6667 Statements:[(X, 1)] NodeID:01.1 P:0.5455 Statements:[(Z, 0)] NodeID:01.1.0 P:0.3333 Statements:[(Y, 0)] NodeID: P:0.5000 Statements:[(Y, 1)] NodeID: P:0.5000 Statements:[(Z, 1)] NodeID:01.1.1 P:0.6667 Statements:[(Y, 1)] NodeID: P:0.2000 Statements:[(Y, 0)] NodeID: P:0.8000
  18. Further details Please check the reference[1] for additional details and

    consideration. Interesting analysis of the application in machine learning can be found in the reference [2] The Causal Inference Engine is work in progress. You can find the code at http:/ /bit.ly/2Mcrh4g Update and tech news in my twitter timeline @davilagrau [1] Algorithms for Causal Reasoning in Probability Trees Genewein et al. (2020) DeepMind https://arxiv.org/abs/2010.12237 [2] Causality for Machine Learning B. Schölkopf (2019) DeepMind https://arxiv.org/abs/1911.10500