Search in sources :

Example 11 with BehaviorModelGED

use of org.iobserve.service.behavior.analysis.model.BehaviorModelGED in project iobserve-analysis by research-iobserve.

the class TestHelper method createBehaviorModelA.

public static BehaviorModelGED createBehaviorModelA() {
    final BehaviorModelGED model = new BehaviorModelGED();
    TestHelper.addNode(model, "Init");
    TestHelper.addNode(model, "A");
    TestHelper.addNode(model, "B");
    TestHelper.addNode(model, "C");
    final String[] parameters = {};
    final String[] values = {};
    final BehaviorModelEdge edge1 = TestHelper.addEdge(model, "Init", "A");
    edge1.addEvent(TestHelper.createEvent(0, "A", parameters, values));
    final BehaviorModelEdge edge2 = TestHelper.addEdge(model, "A", "B");
    edge2.addEvent(TestHelper.createEvent(1, "A", parameters, values));
    final BehaviorModelEdge edge3 = TestHelper.addEdge(model, "B", "C");
    edge3.addEvent(TestHelper.createEvent(2, "C", parameters, values));
    return model;
}
Also used : BehaviorModelEdge(org.iobserve.service.behavior.analysis.model.BehaviorModelEdge) BehaviorModelGED(org.iobserve.service.behavior.analysis.model.BehaviorModelGED)

Example 12 with BehaviorModelGED

use of org.iobserve.service.behavior.analysis.model.BehaviorModelGED in project iobserve-analysis by research-iobserve.

the class TestHelper method createBehaviorModelB.

// only difference to A: different values
public static BehaviorModelGED createBehaviorModelB() {
    final BehaviorModelGED model = new BehaviorModelGED();
    TestHelper.addNode(model, "Init");
    TestHelper.addNode(model, "A");
    TestHelper.addNode(model, "B");
    TestHelper.addNode(model, "C");
    final String[] parameters = {};
    final String[] values = { "different value" };
    final BehaviorModelEdge edge1 = TestHelper.addEdge(model, "Init", "A");
    edge1.addEvent(TestHelper.createEvent(0, "A", parameters, values));
    final BehaviorModelEdge edge2 = TestHelper.addEdge(model, "A", "B");
    edge2.addEvent(TestHelper.createEvent(1, "A", parameters, values));
    final BehaviorModelEdge edge3 = TestHelper.addEdge(model, "B", "C");
    edge3.addEvent(TestHelper.createEvent(2, "C", parameters, values));
    return model;
}
Also used : BehaviorModelEdge(org.iobserve.service.behavior.analysis.model.BehaviorModelEdge) BehaviorModelGED(org.iobserve.service.behavior.analysis.model.BehaviorModelGED)

Example 13 with BehaviorModelGED

use of org.iobserve.service.behavior.analysis.model.BehaviorModelGED in project iobserve-analysis by research-iobserve.

the class OpticsStageTest method setup.

@Before
public void setup() {
    final List<BehaviorModelGED> behaviorModels = new ArrayList<>();
    behaviorModels.add(TestHelper.createBehaviorModelA());
    behaviorModels.add(TestHelper.createBehaviorModelA());
    behaviorModels.add(TestHelper.createBehaviorModelA());
    behaviorModels.add(TestHelper.createBehaviorModelA());
    behaviorModels.add(TestHelper.createBehaviorModelA());
    behaviorModels.add(TestHelper.createBehaviorModelB());
    behaviorModels.add(TestHelper.createBehaviorModelB());
    behaviorModels.add(TestHelper.createBehaviorModelB());
    behaviorModels.add(TestHelper.createBehaviorModelB());
    behaviorModels.add(TestHelper.createBehaviorModelB());
    behaviorModels.add(TestHelper.createBehaviorModelC());
    behaviorModels.add(TestHelper.createBehaviorModelC());
    behaviorModels.add(TestHelper.createBehaviorModelC());
    behaviorModels.add(TestHelper.createBehaviorModelC());
    behaviorModels.add(TestHelper.createBehaviorModelC());
    behaviorModels.add(TestHelper.createBehaviorModelD());
    behaviorModels.add(TestHelper.createBehaviorModelD());
    behaviorModels.add(TestHelper.createBehaviorModelD());
    behaviorModels.add(TestHelper.createBehaviorModelD());
    behaviorModels.add(TestHelper.createBehaviorModelD());
    // noise
    behaviorModels.add(TestHelper.createBehaviorModelE());
    behaviorModels.add(TestHelper.createBehaviorModelE());
    this.models = new ArrayList<>();
    for (final BehaviorModelGED model : behaviorModels) {
        this.models.add(new OpticsData(model));
    }
    this.mTree = TestHelper.generateMTree(this.models);
}
Also used : OpticsData(org.iobserve.service.behavior.analysis.clustering.OpticsData) ArrayList(java.util.ArrayList) BehaviorModelGED(org.iobserve.service.behavior.analysis.model.BehaviorModelGED) Before(org.junit.Before)

Example 14 with BehaviorModelGED

use of org.iobserve.service.behavior.analysis.model.BehaviorModelGED in project iobserve-analysis by research-iobserve.

the class UserSessionToModelConverter method eventsToModel.

/**
 * Converts a list of events into a behavior model
 *
 * @param events
 *            The list of events
 * @return The behavior model
 */
public static BehaviorModelGED eventsToModel(final List<EntryCallEvent> events) {
    final BehaviorModelGED model = new BehaviorModelGED();
    final Iterator<EntryCallEvent> iterator = events.iterator();
    // start with the node "init"
    BehaviorModelNode currentNode = new BehaviorModelNode("Init");
    model.getNodes().put("Init", currentNode);
    BehaviorModelNode lastNode = currentNode;
    // for all events
    while (iterator.hasNext()) {
        final PayloadAwareEntryCallEvent event = (PayloadAwareEntryCallEvent) iterator.next();
        // current node is an existing node with the same name or if non-existing a new node
        currentNode = model.getNodes().get(event.getOperationSignature());
        if (currentNode == null) {
            currentNode = new BehaviorModelNode(event.getOperationSignature());
        }
        // add node to model
        model.getNodes().put(event.getOperationSignature(), currentNode);
        // add edge to model
        UserSessionToModelConverter.addEdge(event, model, lastNode, currentNode);
        lastNode = currentNode;
    }
    return model;
}
Also used : PayloadAwareEntryCallEvent(org.iobserve.stages.general.data.PayloadAwareEntryCallEvent) BehaviorModelNode(org.iobserve.service.behavior.analysis.model.BehaviorModelNode) EntryCallEvent(org.iobserve.stages.general.data.EntryCallEvent) PayloadAwareEntryCallEvent(org.iobserve.stages.general.data.PayloadAwareEntryCallEvent) BehaviorModelGED(org.iobserve.service.behavior.analysis.model.BehaviorModelGED)

Example 15 with BehaviorModelGED

use of org.iobserve.service.behavior.analysis.model.BehaviorModelGED in project iobserve-analysis by research-iobserve.

the class GraphEditDistanceTest method edgeRelevantTest.

@Test
public void edgeRelevantTest() {
    final BehaviorModelGED model1 = TestHelper.createBehaviorModelA();
    final BehaviorModelGED model2 = TestHelper.createBehaviorModelD();
    Assert.assertTrue(this.ged.calculate(model1, model2) > 0);
}
Also used : BehaviorModelGED(org.iobserve.service.behavior.analysis.model.BehaviorModelGED) Test(org.junit.Test)

Aggregations

BehaviorModelGED (org.iobserve.service.behavior.analysis.model.BehaviorModelGED)17 BehaviorModelEdge (org.iobserve.service.behavior.analysis.model.BehaviorModelEdge)7 Test (org.junit.Test)7 BehaviorModelNode (org.iobserve.service.behavior.analysis.model.BehaviorModelNode)3 ArrayList (java.util.ArrayList)2 PayloadAwareEntryCallEvent (org.iobserve.stages.general.data.PayloadAwareEntryCallEvent)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 IOException (java.io.IOException)1 OpticsData (org.iobserve.service.behavior.analysis.clustering.OpticsData)1 EventGroup (org.iobserve.service.behavior.analysis.model.EventGroup)1 EntryCallEvent (org.iobserve.stages.general.data.EntryCallEvent)1 Before (org.junit.Before)1