Liang Information Flow Package
Project description
Created on Mon Sep 7 16:26:22 2020
@Author: Yineng Rong @ yinengrong@foxmail.com
(based on the original MATLAB codes by X. San Liang, which are available at www.ncoads.org)
@Maintainer: Yineng Rong @ yinengrong@foxmail.com
About the module
Causal analysis, a fundamental problem in various disciplines, has recently been recognized as a promising approach to developing an explainable deep learning. However, incorporation of causality into artificial intelligence algorithms is faced with challenges such as ambiguity, non-quantifiability, and computational inefficiency in traditional formalisms. Over the past two decades, these challenges have been essentially fixed, with the development of a rigorous and quantitative causality analysis - the Liang-Kleeman information flow theory (Liang and Kleeman, 2005; Liang, 2008; 2014; 2016; 2021). This theory, which is based on a rigorous footing and derived from first principles, has resulted in notable scientific discoveries in fields ranging from finance, neuroscience, quantum mechanics, artificial intelligence to oceanography, meteorology and climate science. This module provides a practical implementation of the theory, complete with core codes and selected examples. All the codes are translated from the MATLAB scripts orginally written by X.S. Liang and can be downloaded from http://www.ncoads.org/.
Citations:
[1] X.S. Liang, 2016: Information flow and causality as rigorous notions ab initio. Phys. Rev. E, 94, 052202.
[2] X.S. Liang, 2014: Unraveling the cause-effect relation between time series. Phys. Rev. E, 90, 052150.
[3] X.S. Liang, 2021: Normalized multivariate time series causality analysis and causal graph reconstruction. Entropy, 23, 679.
Requirements
- numpy
- scipy
- graphiz (plot causal graph)
Installation
To install LK_Info_flow package, use pip
as follows:
pip install LK_Info_flow
or
pip install .\codes\python\dist\LK_Info_flow-py3-none-any.whl
Standard call for time series or panel data
from LK_Info_Flow import multi_causality_est
IF_result=multi_causality_est(X, max_lag=1, np=1, dt=1, series_temporal_order=None, significance_test=1):
IF_result['IF']
Inputs:
X: matrix storing the M time series (each as Nx1 column vectors)
max_lag: time order of lags (default 1)
>=1 lag time step
-1 Determine the lag order of the data based on the AIC criterion.
-2 Determine the lag order of the data based on the BIC criterion.
np: integer >=1, time advance in performing Euler forward differencing, e.g., 1, 2. Unless the series are generated with a highly chaotic deterministic system, np=1 should be used.
(default 1)
dt: frequency of sampling
(default 1)
series_teporal_order: Nx1 column vector that records the timestamps of each sample, with a minimum sampling interval of dt. This option is used for panel data or datasets with missing measurements.
(default [])
significance_test: 1 do the significance test (default)
0 not (to save the computation time)
Outputs:
a structure value IF_result with sub
IF: information flow
nIF: normalized information flow
SEIF: standard error of information flow
err_e90/e95/e99: standard error at 90/95/99% confidence level
p: p-value of information flow
Standard call for subsystems
from LK_Info_Flow import causality_subspace
IF_result=causality_subspace(X, ind, np=1, dt=1):
IF_result['TAB']
Inputs:
X: matrix storing the M time series (each as Nx1 column vectors)
ind: 2X1 vector (0<=ind[0]<ind[1]<=M); the index ind[0] that separates A from the system: [0:ind[0]] forms A, and the index ind[0] together with ind[1] separates B from the system: [ind[0]:ind[1]] forms B.
np(default 1): integer >=1, time advance in performing Euler forward differencing, e.g., 1, 2. Unless the series are generated with a highly chaotic deterministic system, np=1 should be used.
dt(default 1): frequency of sampling
outputs:
TAB: info flow from subspace A to subspace B
TBA: info flow from subspace B to subspace A
More details are in the example file (example.ipynb)
There are 8 cases in the file:
-
Bivariate causality analysis (Liang, 2014);
-
Multivariable causality analysis (Liang, 2021);
-
Causality analysis with panel data, discontinuous time series or ensemble data (Rong and Liang, 2021)
-
Causal inference between different subsystems (Liang, 2022);
-
Takens' theorem
-
Computational cost for large-scale Liang information flow analysis
-
Causality analysis with data in the presencee of cross-correlated noise
-
Time varying causality analysis;
Citations:
- X. San Liang, 2014: Unraveling the cause-effect relation between time series. Phys. Rev. E 90, 052150.
- X. San Liang, 2015: Normalizing the causality between time series. Phys. Rev. E 92, 022126.
- X. San Liang, 2016: Information flow and causality as rigorous notions ab initio. Phys. Rev. E, 94, 052201.
- X. San Liang, 2021: Normalized Multivariate Time Series Causality Analysis and Causal Graph Reconstruction. Entropy. 23. 679.
for panel data:
- Yineng Rong and X. San Liang, 2021: Panel Data Causal Inference Using a Rigorous Information Flow Analysis for Homogeneous, Independent and Identically Distributed Datasets. IEEE Access. 9, 47266-47274.
for subsystems:
- X. San Liang, 2022: The Causal Interaction between Complex Subsystems. Entropy. 24, 3.
The codes are rewritten from the MATLAB scripts (causality_est.m, tau_est.m, multi_causality_est.m, etc.) on Prof. X. San Liang's lab website (http://www.ncoads.org/article/show/67.aspx)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file lk_info_flow-3.1.2.1.tar.gz
.
File metadata
- Download URL: lk_info_flow-3.1.2.1.tar.gz
- Upload date:
- Size: 18.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0750b9988166a30f536275c5dc7a6dd7b7d2839078212744a69f270b779a708 |
|
MD5 | 79110939a9054ca43dddf1f7f823caec |
|
BLAKE2b-256 | 84e03f98374afca266f64420f8116eb02f22b52069a6918c8403e5a315a2a01e |
File details
Details for the file LK_Info_Flow-3.1.2.1-py3-none-any.whl
.
File metadata
- Download URL: LK_Info_Flow-3.1.2.1-py3-none-any.whl
- Upload date:
- Size: 23.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82c31ab4cbae7fde6a7d86363e902052a2fd94aba43c8322a8df3950ee5be4cb |
|
MD5 | 9114d82de9d1fc1def2fd4128e9a574e |
|
BLAKE2b-256 | 68fa428ca1555153bd80abd91d79445d6f90ba6f0b6653fa3224a4c9d10e4550 |