Skip to content

Commit

Permalink
Merge pull request #90 from IDSIA/dev
Browse files Browse the repository at this point in the history
Release 0.2.1
  • Loading branch information
cbonesana authored Aug 28, 2021
2 parents 29e4660 + 56327b1 commit 1d98b0a
Show file tree
Hide file tree
Showing 72 changed files with 2,320 additions and 600 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
0.2.1
===========

- New *logics* Bayesian factors, such as `Not`, `And`, `Or`, and `NoisyOr` ( #86 )
- New ApproxLP0 algorithm ( #83 )
- Renamed `approxlp` package to `approxpl1` ( #84 )
- Added new `VertexToRandomBayesian` converter ( #84 )

Extra:
- Replaced CI/CD pipeline with GitHub actions ( #84 )
- Added CITATION.cff and CITATION.bib files

0.2.0
===========

Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[![GitHub version](https://badge.fury.io/gh/idsia%2Fcrema.svg)](https://badge.fury.io/gh/idsia%2Fcrema)
[![Build Status](https://travis-ci.org/IDSIA/crema.svg?branch=master)](https://travis-ci.org/IDSIA/crema)

![example workflow](https://github.com/IDSIA/crema/actions/workflows/maven.yaml/badge.svg?branch=master)

<img src="docs/static/img/logo.png" alt="Crema" width="500"/>

CreMA is a open-source java toolbox that provides multiple
CreMA is an open-source java toolbox that provides multiple
learning and inference algorithms for credal models.

An example of exact inference in a credal network is given below.
Expand Down Expand Up @@ -72,7 +71,7 @@ Add the following code in the pom.xml of your project:
<dependency>
<groupId>ch.idsia</groupId>
<artifactId>crema</artifactId>
<version>0.2.0</version>
<version>0.2.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
3 changes: 3 additions & 0 deletions docs/notes/bayesianinference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ the model. This will return the posterior of a variable considered the root of t
.. literalinclude:: ../../examples/BeliefPropagation.java
:language: java
:lines: 42-44
:dedent: 2


To perform an inference on a variable, as an example if you want the marginal of ``P(A)``, use the ``query()`` method as
Expand All @@ -23,6 +24,7 @@ in the example below:
.. literalinclude:: ../../examples/BeliefPropagation.java
:language: java
:lines: 55-60
:dedent: 2


If you want to use evidence, you need to create first a ``TIntIntHashMap`` that will include the state of the various
Expand All @@ -31,6 +33,7 @@ variables, in the belo case we query for ``P(A | B=0)``:
.. literalinclude:: ../../examples/BeliefPropagation.java
:language: java
:lines: 62-69
:dedent: 2


Full example:
Expand Down
17 changes: 4 additions & 13 deletions docs/notes/contact.rst
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
Contact and Support
======================


.. image:: ../_static/img/idsia.png
.. image:: _static/img/idsia.png
:scale: 60 %
:align: center
:target: http://www.idsia.ch

:target: https://www.idsia.ch/

Crema has been developed at the Swiss AI Lab IDSIA (Istituto Dalle Molle di Studi sull'Intelligenza Artificiale),
a not-for-profit research institute for Artificial Intelligence.

Crema has been developed at the Swiss AI Lab IDSIA (Istituto Dalle Molle di Studi sull'Intelligenza Artificiale).
The members of the development and research team are:


- David Huber ([email protected])

- Rafael Cabañas ([email protected])

- Alessandro Antonucci ([email protected])

- Marco Zaffalon ([email protected])

- Claudio Bonesana ([email protected])


If you have any question, please use `Github issues <https://github.com/IDSIA/crema/issues>`_.


8 changes: 2 additions & 6 deletions docs/notes/guideinference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@ run the query. The result is an object of class VertexFactor.

.. literalinclude:: ../../examples/docs/inferEx1.java
:language: java
:lines: 34-39
:lines: 39-42


Approximate inference can be done by means of linear programming. For this, create
the an object of class ``CredalApproxLP`` and then run the query. Note
that the output is an ``IntervalFactor``.



.. literalinclude:: ../../examples/docs/inferEx2.java
:language: java
:lines: 48-54


:lines: 52-58
2 changes: 1 addition & 1 deletion docs/notes/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Crema can be easily included at any maven project. For this, add the following c
<dependency>
<groupId>ch.idsia</groupId>
<artifactId>crema</artifactId>
<version>0.1.6</version>
<version>0.2.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
67 changes: 0 additions & 67 deletions docs/notes/markdownguide.md

This file was deleted.

Binary file modified docs/static/img/idsia.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 11 additions & 10 deletions docs/tutorials/domains.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Domains
.. contents:: Table of Contents
:local:


Domain interface
=======

Expand All @@ -24,6 +25,7 @@ This simple interface declares basic methods to query the domain about variables
.. Note::
Returned arrays should never be modified!


SimpleDomain
============

Expand All @@ -33,22 +35,24 @@ This class encapsulates two integer arrays. One with the variable labels and one
.. literalinclude:: ../../src/test/java/ch/idsia/crema/tutorial/DomainsTutorial.java
:start-after: [simple-domain]
:end-before: [simple-domain]
:dedent: 8
:dedent: 2

.. Warning::
When creating a :code:`SimpleDomain` the list of variables must be sorted!
Crema will **not** automatically sort them, but for some operations will assume they are.


DomainBuilder
=============
While creating a :code:`SimpleDomain` by passing the arrays of variables and their sizes is possible and valid,

While creating a :code:`SimpleDomain` by passing the arrays of variables and their sizes is possible and valid,
a slightly more friendly method is available using the :code:`DomainBuilder`.
Laveraging the ellipses of Java the :code:`DomainBuilder` class avoids the explicit creation of the arrays as shown in the following example.

.. literalinclude:: ../../src/test/java/ch/idsia/crema/tutorial/DomainsTutorial.java
:start-after: [domain-builder-1]
:end-before: [domain-builder-1]
:dedent: 8
:dedent: 2


Strides
Expand All @@ -71,27 +75,26 @@ We we first look at how :code:`Strides` instances can be created conveniently.
.. Note::
The variable's cardinalities are accumlated starting from the variable at index 0.


.. literalinclude:: ../../src/test/java/ch/idsia/crema/tutorial/DomainsTutorial.java
:start-after: [strides]
:end-before: [strides]
:dedent: 8
:dedent: 2

Again, just as with the :code:`SimpleDomain`, creating the object specifying the arrays is valid, but not the most readable solution.
The following example shows an alternative way of creation where variables are added along with their cardinality.

.. literalinclude:: ../../src/test/java/ch/idsia/crema/tutorial/DomainsTutorial.java
:start-after: [domain-builder-strides]
:end-before: [domain-builder-strides]
:dedent: 8
:dedent: 2


Alternative ways to create strides are based on operations on them. Generally Domains are considered unmutable objects and any alteration will result in a new instance.

.. literalinclude:: ../../src/test/java/ch/idsia/crema/tutorial/DomainsTutorial.java
:start-after: [strides-remove]
:end-before: [strides-remove]
:dedent: 8
:dedent: 2

A number of common set operations are available:

Expand All @@ -100,8 +103,6 @@ A number of common set operations are available:
- remove

.. _Enhanced domain:

Working with Strides
--------------------



4 changes: 2 additions & 2 deletions docs/tutorials/factors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
Factors
===============

Credo supports different ways to represent the probability functions defined over the variables. A structure of different categorization
and abstraction around factors have been implemented. At the top of this all we have the concept of :code:`GenericFactor`.
Crema supports different ways to represent the probability functions defined over the variables. A structure of different categorization
and abstraction around factors have been implemented. At the top of this all we have the concept of :code:`GenericFactor`.
2 changes: 1 addition & 1 deletion docs/tutorials/networks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ For a Bayesian Network we will use a :code:`BayesianFactor`.
.. literalinclude:: ../../src/test/java/ch/idsia/crema/tutorial/NetworkTutorial.java
:start-after: [creating-sparse-model]
:end-before: [creating-sparse-model]
:dedent: 8
:dedent: 2
:language: java


Expand Down
4 changes: 2 additions & 2 deletions examples/CredalInferenceExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import ch.idsia.crema.factor.credal.linear.separate.SeparateHalfspaceFactorFactory;
import ch.idsia.crema.factor.credal.vertex.separate.VertexFactor;
import ch.idsia.crema.factor.credal.vertex.separate.VertexFactorFactory;
import ch.idsia.crema.inference.approxlp.ApproxLP1;
import ch.idsia.crema.inference.approxlp.CredalApproxLP;
import ch.idsia.crema.inference.approxlp1.ApproxLP1;
import ch.idsia.crema.inference.approxlp1.CredalApproxLP;
import ch.idsia.crema.inference.approxlp2.ApproxLP2;
import ch.idsia.crema.inference.ve.FactorVariableElimination;
import ch.idsia.crema.inference.ve.VariableElimination;
Expand Down
2 changes: 1 addition & 1 deletion examples/PGMpaper2.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import ch.idsia.crema.factor.credal.linear.interval.IntervalFactor;
import ch.idsia.crema.factor.credal.linear.separate.SeparateHalfspaceFactor;
import ch.idsia.crema.factor.credal.linear.separate.SeparateHalfspaceFactorFactory;
import ch.idsia.crema.inference.approxlp.CredalApproxLP;
import ch.idsia.crema.inference.approxlp1.CredalApproxLP;
import ch.idsia.crema.model.graphical.DAGModel;
import org.apache.commons.math3.optim.linear.Relationship;

Expand Down
2 changes: 1 addition & 1 deletion examples/docs/inferEx2.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import ch.idsia.crema.factor.credal.linear.interval.IntervalFactor;
import ch.idsia.crema.factor.credal.linear.separate.SeparateHalfspaceFactor;
import ch.idsia.crema.factor.credal.linear.separate.SeparateHalfspaceFactorFactory;
import ch.idsia.crema.inference.approxlp.CredalApproxLP;
import ch.idsia.crema.inference.approxlp1.CredalApproxLP;
import ch.idsia.crema.model.graphical.DAGModel;
import ch.idsia.crema.model.graphical.GraphicalModel;
import org.apache.commons.math3.optim.linear.Relationship;
Expand Down
Loading

0 comments on commit 1d98b0a

Please sign in to comment.