https://github.com/idsia/credici
Credici: Credal Inference for Causal Inference
https://github.com/idsia/credici
causal-inference causal-models causality credal imprecise-probability probabilistic-graphical-models
Last synced: about 2 months ago
JSON representation
Credici: Credal Inference for Causal Inference
- Host: GitHub
- URL: https://github.com/idsia/credici
- Owner: IDSIA
- License: lgpl-3.0
- Created: 2020-06-12T14:48:46.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-03-20T06:38:45.000Z (about 1 year ago)
- Last Synced: 2024-03-20T07:40:41.509Z (about 1 year ago)
- Topics: causal-inference, causal-models, causality, credal, imprecise-probability, probabilistic-graphical-models
- Language: Java
- Homepage: https://credici.readthedocs.io/
- Size: 978 MB
- Stars: 13
- Watchers: 8
- Forks: 1
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Credici is an open-source library that allows to use credal inference methods
for causal analysis:```
import ch.idsia.credici.inference.CredalCausalApproxLP;
import ch.idsia.credici.inference.CredalCausalVE;
import ch.idsia.credici.model.StructuralCausalModel;
import ch.idsia.crema.IO;
import ch.idsia.crema.factor.credal.linear.IntervalFactor;
import ch.idsia.crema.factor.credal.vertex.VertexFactor;
import ch.idsia.crema.model.graphical.specialized.BayesianNetwork;
import gnu.trove.map.TIntIntMap;
import gnu.trove.map.hash.TIntIntHashMap;import java.io.IOException;
public class EquationlessFromFile {
public static void main(String[] args) throws IOException, InterruptedException {// Load the empirical model
String fileName = "./models/simple-bayes.uai";
BayesianNetwork bnet = (BayesianNetwork) IO.read(fileName);// Get the markovian equationless SCM
StructuralCausalModel causalModel = StructuralCausalModel.of(bnet);// Set query
TIntIntMap intervention = new TIntIntHashMap();
intervention.put(0,1);
int target = 1;// Approx inference
CredalCausalAproxLP inf = new CredalCausalAproxLP(causalModel, bnet.getFactors());
IntervalFactor res = inf.doQuery(target, intervention);
System.out.println(res);//Exact inference
CredalCausalVE inf2 = new CredalCausalVE(causalModel, bnet.getFactors());
VertexFactor res2 = inf2.doQuery(target, intervention);
System.out.println(res2);
}
}```
## Installation
Add the following code in the pom.xml of your project:
```
cremaRepo
https://raw.github.com/idsia/crema/mvn-repo/
ch.idsia
credici
0.1.4
compile
```