Metadata-Version: 2.4
Name: causalnn
Version: 0.1
Summary: CausalNN package is the implementation of the TS-CausalNN causal discovery method for time series data.
Author: Omar Faruque and Jianwu Wang
Keywords: TS-CausalNN,Causal Discovery,Time-series data
Description-Content-Type: text/markdown
Dynamic: author
Dynamic: description
Dynamic: description-content-type
Dynamic: keywords
Dynamic: summary

# TS-CausalNN: Time-Series Causal Neural Network

**TS-CausalNN** is a lcausal discovery method for **Non-linear Non-stationary Time Series Data**. It is a deep learning technique to
discover contemporaneous and lagged causal relations simultaneously. Our proposed architecture comprises (i) convolutional
blocks comprising parallel custom causal layers, (ii) acyclicity
constraint, and (iii) optimization techniques using the augmented
Lagrangian approach.

## Important Assumptions

**Assumption 1** (Markov and Faithfulness): Assume Xi,i∈
{1,...,n}is Markov and faithful to the true/generated causal
graph G.

**Assumption 2** (Causal Sufficiency): We assume that there are
no unobserved confounders in the data generation process.

**Assumption 3** (Causal Consistency): We assume that time-
lagged and instantaneous causal relations between the vari-
ables are consistent through all time steps.

**Assumption 4** (Acyclicity): This assumption states that there
are no causal paths that begin and end at the same node.


## Demo Code With Synthetic Data
```python
from causalnn import train_causalnn_model

mat_weights, shd, accuracy, precision, recall, FDR, F1 = train_causalnn_model(data_type="synthetic")
print('SHD: {}, Accuracy: {}, Precision: {}, Recall: {}, FDR: {}, F1 Score: {}'.format(shd, accuracy, precision, recall, FDR,F1))

```

## Dependencies

Python>=3.12

Tensorflow>=2.20.0 

Tensorflow_probability>=0.24.0

Sklearn

Numpy

Pandas

## Installation

```bash
pip install causalnn
```


**Paper Reference**

*TS-CausalNN: Learning Temporal Causal Relations from Non-Linear Non-Stationary Time Series Data*
Authors: Omar Faruque (University of Maryland, Baltimore County, USA), Sahara Ali (University of North Texas, USA), Xue Zheng (Lawrence Livermore National Laboratory, USA), Jianwu Wang (University of Maryland, USA)
2025 IEEE International Conference on Data Mining Workshops (ICDMW)
DOI 10.1109/ICDMW69685.2025.00043
