use of org.iobserve.analysis.behavior.models.extended.BehaviorModel in project iobserve-analysis by research-iobserve.
the class VectorizationStage method execute.
@Override
protected void execute() {
final BehaviorModel model = this.modelInputPort.receive();
final Long timestamp = this.timerInputPort.receive();
if (model != null) {
this.vectorizeModel(model);
this.models.add(model);
}
if (timestamp != null && this.models.size() > 1) {
/**
* Convert vectors from List<List<Double>> to Double[][]
*/
final Double[][] vectorArray = new Double[this.distanceVectors.size()][];
int i = 0;
for (final List<Double> v : this.distanceVectors) {
vectorArray[i++] = v.toArray(new Double[v.size()]);
}
/**
* Convert models from list to array
*/
final BehaviorModel[] modelsArray = this.models.toArray(new BehaviorModel[this.models.size()]);
/**
* Send both
*/
VectorizationStage.LOGGER.debug(this.vectorsAsJSON());
VectorizationStage.LOGGER.debug("Sending vectors and models to next stage (max. parameter radius: {}, max structure radius: {}", this.maximumParameterDistance, this.maximumStructureDistance);
this.vectorsOutputPort.send(vectorArray);
this.modelsOutputPort.send(modelsArray);
/**
* Clear state to prepare for arrival of new sessions
*/
this.clearModels();
}
}
use of org.iobserve.analysis.behavior.models.extended.BehaviorModel in project iobserve-analysis by research-iobserve.
the class BehaviorModelCreationStage method execute.
@Override
protected void execute(final Instances instances) {
final int size = instances.numInstances();
for (int i = 0; i < size; i++) {
final Instance instance = instances.instance(i);
final Optional<BehaviorModel> behaviorModel = this.createBehaviorModel(instances, instance);
final String modelName = this.namePrefix + i;
behaviorModel.ifPresent(model -> model.setName(modelName));
behaviorModel.ifPresent(this.outputPort::send);
}
}
use of org.iobserve.analysis.behavior.models.extended.BehaviorModel in project iobserve-analysis by research-iobserve.
the class ModelComparisonStageTest method createReferenceModel.
private BehaviorModel createReferenceModel() {
final BehaviorModel model = new BehaviorModel();
model.addNode(this.nodeA, false);
model.addNode(this.nodeB, false);
model.addNode(this.nodeC, false);
final EntryCallEdge edgeAB = new EntryCallEdge(this.nodeA, this.nodeB);
edgeAB.addCalls(4);
model.addEdge(edgeAB, false);
final EntryCallEdge edgeBA = new EntryCallEdge(this.nodeB, this.nodeA);
edgeBA.addCalls(3);
model.addEdge(edgeBA, false);
final EntryCallEdge edgeBC = new EntryCallEdge(this.nodeB, this.nodeC);
edgeBA.addCalls(1);
model.addEdge(edgeBC, false);
return model;
}
Aggregations