Skip to content

Commit d932805

Browse files
committed
preparing 0.1.4
1 parent 42afdff commit d932805

File tree

4 files changed

+47
-29
lines changed

4 files changed

+47
-29
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
0.1.4
2+
===========
3+
4+
- Common interface for inference algorithms.
5+
- Solved bugs at renaming and sort parents.
6+
- Bug at LP #23.
7+
- Documentation available.
8+
9+
10+
111
0.1.3
212
===========
313

README.md

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,49 @@ learning and inference algorithms for credal models.
99

1010
An example of exact inference in a credal network is given below.
1111

12-
```
12+
```java
13+
import ch.idsia.crema.factor.credal.vertex.VertexFactor;
14+
import ch.idsia.crema.inference.ve.CredalVariableElimination;
15+
import ch.idsia.crema.model.ObservationBuilder;
16+
import ch.idsia.crema.model.Strides;
17+
import ch.idsia.crema.model.graphical.SparseModel;
1318

14-
double p = 0.2;
15-
double eps = 0.0001;
19+
public class Starting {
20+
public static void main(String[] args) {
21+
double p = 0.2;
22+
double eps = 0.0001;
1623

17-
/* CN defined with vertex Factor */
24+
/* CN defined with vertex Factor */
1825

19-
// Define the model (with vertex factors)
20-
SparseModel model = new SparseModel();
21-
int u = model.addVariable(3);
22-
int x = model.addVariable(2);
23-
model.addParent(x,u);
26+
// Define the model (with vertex factors)
27+
SparseModel model = new SparseModel();
28+
int A = model.addVariable(3);
29+
int B = model.addVariable(2);
30+
model.addParent(B,A);
2431

25-
// Define a credal set of the partent node
26-
VertexFactor fu = new VertexFactor(model.getDomain(u), Strides.empty());
27-
fu.addVertex(new double[]{0., 1-p, p});
28-
fu.addVertex(new double[]{1-p, 0., p});
29-
model.setFactor(u,fu);
32+
// Define a credal set of the partent node
33+
VertexFactor fu = new VertexFactor(model.getDomain(A), Strides.empty());
34+
fu.addVertex(new double[]{0., 1-p, p});
35+
fu.addVertex(new double[]{1-p, 0., p});
36+
model.setFactor(A,fu);
3037

3138

32-
System.out.println(p+" "+(1-p));
39+
// Define the credal set of the child
40+
VertexFactor fx = new VertexFactor(model.getDomain(B), model.getDomain(A));
3341

34-
// Define the credal set of the child
35-
VertexFactor fx = new VertexFactor(model.getDomain(x), model.getDomain(u));
42+
fx.addVertex(new double[]{1., 0.,}, 0);
43+
fx.addVertex(new double[]{1., 0.,}, 1);
44+
fx.addVertex(new double[]{0., 1.,}, 2);
3645

37-
fx.addVertex(new double[]{1., 0.,}, 0);
38-
fx.addVertex(new double[]{1., 0.,}, 1);
39-
fx.addVertex(new double[]{0., 1.,}, 2);
46+
model.setFactor(B,fx);
4047

41-
model.setFactor(x,fx);
48+
// Run exact inference
49+
CredalVariableElimination inf = new CredalVariableElimination(model);
50+
inf.query(A, ObservationBuilder.observe(B,0));
51+
52+
}
53+
}
4254

43-
// Run exact inference inference
44-
VariableElimination ve = new FactorVariableElimination(model.getVariables());
45-
ve.setFactors(model.getFactors());
46-
System.out.println(ve.run(x));
4755

4856

4957
```
@@ -52,7 +60,7 @@ System.out.println(ve.run(x));
5260

5361
Add the following code in the pom.xml of your project:
5462

55-
```
63+
```xml
5664
<repositories>
5765
<repository>
5866
<id>cremaRepo</id>
@@ -64,7 +72,7 @@ Add the following code in the pom.xml of your project:
6472
<dependency>
6573
<groupId>ch.idsia</groupId>
6674
<artifactId>crema</artifactId>
67-
<version>0.1.3</version>
75+
<version>0.1.4</version>
6876
<scope>compile</scope>
6977
</dependency>
7078
</dependencies>

docs/notes/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Crema can be easily included at any maven project. For this, add the following c
1616
<dependency>
1717
<groupId>ch.idsia</groupId>
1818
<artifactId>Crema</artifactId>
19-
<version>0.1.3</version>
19+
<version>0.1.4</version>
2020
<scope>compile</scope>
2121
</dependency>
2222
</dependencies>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>ch.idsia</groupId>
55
<artifactId>crema</artifactId>
6-
<version>0.1.4-SNAPSHOT</version>
6+
<version>0.1.4</version>
77

88
<name>Credal Model Algorithms</name>
99

0 commit comments

Comments
 (0)