Skip to content

Soft Conformance

Dependency

To use these algorithms in your Java Maven project it is necessary to include, in the pom.xml file, the dependency:

<dependency>
    <groupId>com.github.beamline</groupId>
    <artifactId>soft-conformance</artifactId>
    <version>master-SNAPSHOT</version>
</dependency>
See the introduction page for further instructions.

Usage

This conformance approach uses a descriptive model (i.e., a pattern of the observed behavior over a certain amount of time) which is not necessarily referring to the control-flow (e.g., it can be based on the social network of handover of work). To create such a model you need to specify the states and the probability of transitioning. Additionally, it is necessary to specify the likelihood of a random walk (i.e., the parameter α):

1
2
3
4
5
6
7
PDFA reference = new PDFA();
reference.addNode("A");
reference.addNode("B");
reference.addNode("C");
reference.addEdge("A", "A", 0.2);
reference.addEdge("A", "B", 0.8);
reference.addEdge("B", "C", 1);
This model can be visualized with:
PDFAVisualizer.getDot(reference).exportToSvg(new File("test.svg"));
And here is the output:

G e12bcafde-7737-4297-8e45-971bef8040b2 A e12bcafde-7737-4297-8e45-971bef8040b2->e12bcafde-7737-4297-8e45-971bef8040b2 0.2 e57c465e7-ec29-4da2-9d3e-e1362a897715 B e12bcafde-7737-4297-8e45-971bef8040b2->e57c465e7-ec29-4da2-9d3e-e1362a897715 0.8 e87bdcf03-5fcf-4aa6-b098-e2ab971bca74 C e57c465e7-ec29-4da2-9d3e-e1362a897715->e87bdcf03-5fcf-4aa6-b098-e2ab971bca74 1

As can be seen, the model does not allow for any deviation, so it is possible to add weights for possible deviations by using:

reference = WeightsNormalizer.normalize(reference, alpha);
Which transforms the model into:

G edf5adbb8-1495-49f7-bf4d-dae11812ecf2 A edf5adbb8-1495-49f7-bf4d-dae11812ecf2->edf5adbb8-1495-49f7-bf4d-dae11812ecf2 0.27 eab3fce2a-df45-43e8-9b62-89ce28ff3320 B edf5adbb8-1495-49f7-bf4d-dae11812ecf2->eab3fce2a-df45-43e8-9b62-89ce28ff3320 0.57 ea8b69327-9b41-4ca2-90b3-b6c8a50b04d4 C edf5adbb8-1495-49f7-bf4d-dae11812ecf2->ea8b69327-9b41-4ca2-90b3-b6c8a50b04d4 0.17 eab3fce2a-df45-43e8-9b62-89ce28ff3320->edf5adbb8-1495-49f7-bf4d-dae11812ecf2 0.17 eab3fce2a-df45-43e8-9b62-89ce28ff3320->eab3fce2a-df45-43e8-9b62-89ce28ff3320 0.17 eab3fce2a-df45-43e8-9b62-89ce28ff3320->ea8b69327-9b41-4ca2-90b3-b6c8a50b04d4 0.67 ea8b69327-9b41-4ca2-90b3-b6c8a50b04d4->edf5adbb8-1495-49f7-bf4d-dae11812ecf2 0.17 ea8b69327-9b41-4ca2-90b3-b6c8a50b04d4->eab3fce2a-df45-43e8-9b62-89ce28ff3320 0.17 ea8b69327-9b41-4ca2-90b3-b6c8a50b04d4->ea8b69327-9b41-4ca2-90b3-b6c8a50b04d4 0.17

Please note that these models can also be mined. Once a model is available, it is possible to use it for conformance checking with:

PDFA reference = ...;
int maxCasesToStore = 1000; // max expected number of parallel process instances

PDFAConformance conformance = new PDFAConformance(reference, maxCasesToStore);
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env
    .addSource(source)
    .keyBy(BEvent::getTraceName)
    .flatMap(conformance)
    .addSink(new SinkFunction<SoftConformanceReport>(){
        public void invoke(SoftConformanceReport value) throws Exception {
            for(String caseId : value.keySet()) {
                System.out.println(
                    "Case: " + caseId + "\t" +
                    "soft conformance: " + value.get(caseId).getSoftConformance() + "\t" +
                    "mean of probs: " + value.get(caseId).getMeanProbabilities());
            }
        };
    });
env.execute();

It is worth highlighting that since each trace can be processed independently from the others, it is possible to increase the parallelism by keying the stream based on the case identifier (BEvent::getTraceName, line 16).

Scientific literature

The techniques implemented in this package are described in: