Giter Site home page Giter Site logo

identifying_causal_structure's Introduction

Identifying Causal Structure in Dynamical Systems

This repository contains an algorithm for automatically identifying the causal structure of a dynamical system. The algorithm is implemented for a synthetic, linear example and a nonlinear quadruple tank system. A description of the method can be found in:

  • Dominik Baumann, Friedrich Solowjow, Karl Henrik Johansson, and Sebastian Trimpe, "Identifying causal structure in dynamical systems," Transactions on Machine Learning Research, 2022, arXiv.

Requirements

The code was developed using Python 3.8.10. The following libraries are required:

  • numpy (tested with version 1.23.1)
  • scipy (tested with version 1.8.0)
  • GPy (tested with version 1.10.0)

Examples

We provide to examples: a synthetic, linear example, and a nonlinear quadruple tank system.

Synthetic linear example

The synthetic linear example serves as a proof of concept at low compute time. We estimate a linear state-space model for the system using least-squares and then subsequently identify its causal structure. For each experiment, we steer the system to its initial condition instead of just setting them in the code to be more realistic.

Quadruple tank system

For the quadruple tank system, we estimate a Gaussian process (GP) model. For the paper, this was achieved using parallel computing. To simplify running the algorithm and enhance reproducibility, we here provide an implementation without parallel computing and less data used to learn the GP model, which reduces the computational demand of GP inference. This leads to slightly higher test statistics as reported in the paper, but the qualitative results are the same.

Execution

To execute the code, run the command:

python caus_id_linear.py

for the linear synthetic example and

python caus_id_GP.py

for the quadruple tank system.

The algorithm after each iteration prints a "causality matrix", i.e., a matrix, indicating which variables have a causal influence on one another. In the beginning, all entries are 0 since our null hypothesis is that variables do not cause each other. If a variable is found to cause some other variables, this 0 is replaced by a 1. A 1 in line 2, column 1, for instance, indicates that variable x2 causes variable x1.

Results

After finishing, the final causality matrix the algorithm should be

x1 x2 x3 u1 u2 u3
x1 1 1 1 1 1 1
x2 0 1 1 1 1 1
x3 0 0 1 1 0 1

for the synthetic example and

x1 x2 x3 x4 u1 u2
x1 1 0 1 0 1 1
x2 0 1 0 1 1 1
x3 0 0 1 0 0 1
x4 0 0 0 1 1 0

for the quadruple tank system

identifying_causal_structure's People

Contributors

wangcj05 avatar baumanndominik avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.