Skip to content

Commit 540d11f

Browse files
authoredJun 18, 2021
Merge pull request #78 from IDSIA/dev
Release 0.2.0
2 parents d552cdd + cd95cd3 commit 540d11f

File tree

241 files changed

+9054
-5724
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

241 files changed

+9054
-5724
lines changed
 

‎CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
0.2.0
2+
===========
3+
4+
- New Factor hierarchy ( #74 ). Major changes are:
5+
* All factors are now **interfaces**.
6+
* For each `factor` we can have multiple implementations.
7+
* `Factor`s are **immutable** now: the creation of a new factor is delegated to the `constructor` or to a dedicated `Factory` class.
8+
* `SymbolicFactor`s can now be used to keep track of operations done by algorithms.
9+
- Added code for isipta21benchamrk ( #76 #77 )
10+
- Removed old methods marked as `@deprecated`
11+
12+
0.1.7.a
13+
===========
14+
15+
- Fixed an issue with sampling of `BayesianFactors` #75
16+
117
0.1.7
218
===========
319

‎README.md

+39-35
Original file line numberDiff line numberDiff line change
@@ -10,45 +10,49 @@ learning and inference algorithms for credal models.
1010
An example of exact inference in a credal network is given below.
1111

1212
```java
13-
import ch.idsia.crema.factor.credal.vertex.VertexFactor;
14-
import ch.idsia.crema.inference.ve.CredalVariableElimination;
1513
import ch.idsia.crema.core.ObservationBuilder;
1614
import ch.idsia.crema.core.Strides;
15+
import ch.idsia.crema.factor.credal.vertex.separate.VertexFactor;
16+
import ch.idsia.crema.factor.credal.vertex.separate.VertexFactorFactory;
17+
import ch.idsia.crema.inference.ve.CredalVariableElimination;
18+
import ch.idsia.crema.model.graphical.DAGModel;
1719
import ch.idsia.crema.model.graphical.GraphicalModel;
1820

1921
public class Starting {
20-
public static void main(String[] args) {
21-
double p = 0.2;
22-
double eps = 0.0001;
23-
24-
/* CN defined with vertex Factor */
25-
26-
// Define the model (with vertex factors)
27-
GraphicalModel<VertexFactor> model = new DAGModel<>();
28-
int A = model.addVariable(3);
29-
int B = model.addVariable(2);
30-
31-
model.addParent(B,A);
32-
33-
// Define a credal set of the partent node
34-
VertexFactor fu = new VertexFactor(model.getDomain(A), Strides.empty());
35-
fu.addVertex(new double[]{0., 1-p, p});
36-
fu.addVertex(new double[]{1-p, 0., p});
37-
38-
model.setFactor(A,fu);
39-
40-
// Define the credal set of the child
41-
VertexFactor fx = new VertexFactor(model.getDomain(B), model.getDomain(A));
42-
fx.addVertex(new double[]{1., 0.,}, 0);
43-
fx.addVertex(new double[]{1., 0.,}, 1);
44-
fx.addVertex(new double[]{0., 1.,}, 2);
45-
46-
model.setFactor(B,fx);
47-
48-
// Run exact inference
49-
CredalVariableElimination<VertexFactor> inf = new CredalVariableElimination<>(model);
50-
inf.query(A, ObservationBuilder.observe(B,0));
51-
}
22+
public static void main(String[] args) {
23+
double p = 0.2;
24+
double eps = 0.0001;
25+
26+
/* CN defined with vertex Factor */
27+
28+
// Define the model (with vertex factors)
29+
GraphicalModel<VertexFactor> model = new DAGModel<>();
30+
int A = model.addVariable(3);
31+
int B = model.addVariable(2);
32+
33+
model.addParent(B, A);
34+
35+
// Define a credal set of the partent node
36+
VertexFactor fu = VertexFactorFactory.factory().domain(model.getDomain(A), Strides.empty())
37+
.addVertex(new double[]{0., 1 - p, p})
38+
.addVertex(new double[]{1 - p, 0., p})
39+
.get();
40+
41+
model.setFactor(A, fu);
42+
43+
// Define the credal set of the child
44+
VertexFactor fx = VertexFactorFactory.factory().domain(model.getDomain(B), model.getDomain(A))
45+
.addVertex(new double[]{1., 0.,}, 0)
46+
.addVertex(new double[]{1., 0.,}, 1)
47+
.addVertex(new double[]{0., 1.,}, 2)
48+
.get();
49+
50+
model.setFactor(B, fx);
51+
52+
// Run exact inference
53+
CredalVariableElimination inf = new CredalVariableElimination();
54+
inf.query(model, ObservationBuilder.observe(B, 0), A);
55+
}
5256
}
5357
```
5458

@@ -68,7 +72,7 @@ Add the following code in the pom.xml of your project:
6872
<dependency>
6973
<groupId>ch.idsia</groupId>
7074
<artifactId>crema</artifactId>
71-
<version>0.1.6</version>
75+
<version>0.1.7</version>
7276
<scope>compile</scope>
7377
</dependency>
7478
</dependencies>

0 commit comments

Comments
 (0)
Please sign in to comment.