Skip to content

Commit

Permalink
Bug fixing in order to run experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
SLenga committed Jun 19, 2018
1 parent e999e12 commit cf8cc9b
Show file tree
Hide file tree
Showing 11 changed files with 477 additions and 463 deletions.
62 changes: 31 additions & 31 deletions analysis/analysis.config
@@ -1,32 +1,32 @@
kieker.monitoring.name=JIRA
kieker.monitoring.hostname=
kieker.monitoring.metadata=true

iobserve.analysis.source=org.iobserve.service.source.FileSourceCompositeStage
org.iobserve.service.source.FileSourceCompositeStage.sourceDirectories=/Users/student/git/single-jpetstore-clustering-experiment/fixed/FishLover/kieker-20180328-213823-1404917594578390-UTC--

iobserve.analysis.traces=true
iobserve.analysis.dataFlow=true

iobserve.analysis.model.pcm.directory.db=/Users/student/git/single-jpetstore-clustering-experiment/db
iobserve.analysis.model.pcm.directory.init=/Users/student/git/single-jpetstore-clustering-experiment/pcm

# trace preparation (note they should be fixed)
iobserve.analysis.behavior.IEntryCallTraceMatcher=org.iobserve.analysis.systems.jira.JIRACallTraceMatcher
iobserve.analysis.behavior.IEntryCallAcceptanceMatcher=org.iobserve.analysis.systems.jira.JIRATraceAcceptanceMatcher
iobserve.analysis.behavior.ITraceSignatureCleanupRewriter=org.iobserve.analysis.systems.jira.JIRASignatureCleanupRewriter
iobserve.analysis.behavior.IModelGenerationFilterFactory=org.iobserve.analysis.systems.jpetstore.JPetStoreEntryCallRulesFactory

iobserve.analysis.behavior.triggerInterval=1000

iobserve.analysis.behavior.sink.baseUrl=/Users/student/git/single-jpetstore-clustering-experiment/results
iobserve.analysis.container.management.sink.visualizationUrl=http://localhost:8080

# Example Xmeans
iobserve.analysis.behaviour.filter=org.iobserve.analysis.clustering.xmeans.XMeansBehaviorCompositeStage
org.iobserve.analysis.behavior.clustering.xmeans.XMeansBehaviorCompositeStage.expectedUserGroups=1
org.iobserve.analysis.behavior.clustering.xmeans.XMeansBehaviorCompositeStage.variance=1
org.iobserve.analysis.behavior.clustering.xmeans.XMeansBehaviorCompositeStage.prefix=jira
org.iobserve.analysis.behavior.clustering.xmeans.XMeansBehaviorCompositeStage.outputUrl=/Users/student/git/single-jpetstore-clustering-experiment/results
org.iobserve.analysis.behavior.clustering.xmeans.XMeansBehaviorCompositeStage.representativeStrategy=org.iobserve.analysis.systems.jira.JIRARepresentativeStrategy
kieker.monitoring.name=JIRA
kieker.monitoring.hostname=
kieker.monitoring.metadata=true
iobserve.analysis.source=org.iobserve.service.source.FileSourceCompositeStage
org.iobserve.service.source.FileSourceCompositeStage.sourceDirectories=/Users/student/git/single-jpetstore-clustering-experiment/fixed/FishLover/kieker-20180328-213823-1404917594578390-UTC--
iobserve.analysis.traces=true
iobserve.analysis.dataFlow=false
iobserve.analysis.model.pcm.directory.db=/Users/student/git/single-jpetstore-clustering-experiment/db
iobserve.analysis.model.pcm.directory.init=/Users/student/git/single-jpetstore-clustering-experiment/pcm
# trace preparation (note they should be fixed)
iobserve.analysis.behavior.IEntryCallTraceMatcher=org.iobserve.analysis.systems.jira.JIRACallTraceMatcher
iobserve.analysis.behavior.IEntryCallAcceptanceMatcher=org.iobserve.analysis.systems.jira.JIRATraceAcceptanceMatcher
iobserve.analysis.behavior.ITraceSignatureCleanupRewriter=org.iobserve.analysis.systems.jira.JIRASignatureCleanupRewriter
iobserve.analysis.behavior.IModelGenerationFilterFactory=org.iobserve.analysis.systems.jpetstore.JPetStoreEntryCallRulesFactory
iobserve.analysis.behavior.triggerInterval=1000
iobserve.analysis.behavior.sink.baseUrl=/Users/student/git/single-jpetstore-clustering-experiment/results
iobserve.analysis.container.management.sink.visualizationUrl=http://localhost:8080
# Example Xmeans
iobserve.analysis.behavior.filter=org.iobserve.analysis.behavior.clustering.xmeans.XMeansBehaviorCompositeStage
org.iobserve.analysis.behavior.clustering.xmeans.XMeansBehaviorCompositeStage.expectedUserGroups=1
org.iobserve.analysis.behavior.clustering.xmeans.XMeansBehaviorCompositeStage.variance=1
org.iobserve.analysis.behavior.clustering.xmeans.XMeansBehaviorCompositeStage.prefix=jira
org.iobserve.analysis.behavior.clustering.xmeans.XMeansBehaviorCompositeStage.outputUrl=/Users/student/git/single-jpetstore-clustering-experiment/results
org.iobserve.analysis.behavior.clustering.xmeans.XMeansBehaviorCompositeStage.representativeStrategy=org.iobserve.analysis.systems.jira.JIRARepresentativeStrategy
# End Example
Expand Up @@ -18,13 +18,13 @@
import java.util.ArrayList;
import java.util.List;

import org.iobserve.analysis.data.UserSessionCollectionModel;
import org.iobserve.analysis.session.data.UserSession;

import teetime.framework.AbstractStage;
import teetime.framework.InputPort;
import teetime.framework.OutputPort;

import org.iobserve.analysis.data.UserSessionCollectionModel;
import org.iobserve.analysis.session.data.UserSession;

/**
* This filter collects user sessions until a time trigger event. All events passed the sliding
* window are removed from the session pool.
Expand Down Expand Up @@ -56,9 +56,17 @@ protected void execute() throws Exception {
if (timeTrigger != null) {
// TODO please note this is a temporary measure, in future, we might just send the list
// or stream of sessions.
this.userSessions.stream().filter(
userSession -> userSession.getEntryTime() > timeTrigger - UserSessionModelAggregator.SLIDING_WINDOW)
.forEach(userSession -> this.userSessions.remove(userSession));
for (int i = 0; i < this.userSessions.size(); i++) {
final UserSession userSession = this.userSessions.get(i);
if (userSession != null) {
final Long entryTime = userSession.getEntryTime();
final Long lowerBoundary = timeTrigger - UserSessionModelAggregator.SLIDING_WINDOW;
if (entryTime < lowerBoundary) {
this.userSessions.remove(i);
}
}
}

final UserSessionCollectionModel model = new UserSessionCollectionModel(this.userSessions);
this.outputPort.send(model);
}
Expand Down
@@ -1,71 +1,72 @@
/***************************************************************************
* Copyright (C) 2018 iObserve Project (https://www.iobserve-devops.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/

package org.iobserve.analysis.behavior.clustering.hierarchical;

import org.iobserve.analysis.behavior.filter.BehaviorModelCreationStage;
import org.iobserve.analysis.behavior.filter.VectorQuantizationClusteringStage;
import org.iobserve.analysis.behavior.models.data.configuration.ISignatureCreationStrategy;
import org.iobserve.analysis.sink.AbstractBehaviorModelOutputSink;
import org.iobserve.analysis.sink.BehaviorModelSink;

import teetime.framework.CompositeStage;
import teetime.framework.InputPort;
import weka.core.Instances;

/**
* @author Stephan Lenga
*
*/
public class HierarchicalBehaviorModelAggregation extends CompositeStage {
//private final VectorQuantizationClusteringStage clustering;

/**
* Constructor configuration of the aggregation filters.
*
* @param namePrefix
* name prefix
* @param visualizationUrl
* path or url for the sink
* @param signatureCreationStrategy
* signature creation strategy
*/
public HierarchicalBehaviorModelAggregation(final String namePrefix, final String visualizationUrl,
final ISignatureCreationStrategy signatureCreationStrategy) {
final BehaviorModelCreationStage behaviorModelCreationStage = new BehaviorModelCreationStage(namePrefix);

// NEED HierarchicalClusteringStage in analysis.behavior.filter
//this.clustering = new HierarchicalClusteringStage(new HierarchicalClustering()); // Arguments
// may be
// necessary
//this.connectPorts(this.clustering.getOutputPort(), behaviorModelCreationStage.getInputPort());

/** visualization integration. */
//final AbstractBehaviorModelOutputSink tIObserveUBM = new BehaviorModelSink(visualizationUrl,
// signatureCreationStrategy);

//this.connectPorts(behaviorModelCreationStage.getOutputPort(), tIObserveUBM.getInputPort());
}

/**
* Get input port.
*
* @return input port
*/
public InputPort<Instances> getInputPort() {
return this.clustering.getInputPort();
}
}
/***************************************************************************
* Copyright (C) 2018 iObserve Project (https://www.iobserve-devops.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/

package org.iobserve.analysis.behavior.clustering.hierarchical;

import org.iobserve.analysis.behavior.filter.BehaviorModelCreationStage;
import org.iobserve.analysis.behavior.models.data.configuration.ISignatureCreationStrategy;

import teetime.framework.CompositeStage;
import teetime.framework.InputPort;
import weka.core.Instances;

/**
* @author Stephan Lenga
*
*/
public class HierarchicalBehaviorModelAggregation extends CompositeStage {
// private final VectorQuantizationClusteringStage clustering;

/**
* Constructor configuration of the aggregation filters.
*
* @param namePrefix
* name prefix
* @param visualizationUrl
* path or url for the sink
* @param signatureCreationStrategy
* signature creation strategy
*/
public HierarchicalBehaviorModelAggregation(final String namePrefix, final String visualizationUrl,
final ISignatureCreationStrategy signatureCreationStrategy) {
final BehaviorModelCreationStage behaviorModelCreationStage = new BehaviorModelCreationStage(namePrefix);

// NEED HierarchicalClusteringStage in analysis.behavior.filter
// this.clustering = new HierarchicalClusteringStage(new HierarchicalClustering()); //
// Arguments
// may be
// necessary
// this.connectPorts(this.clustering.getOutputPort(),
// behaviorModelCreationStage.getInputPort());

/** visualization integration. */
// final AbstractBehaviorModelOutputSink tIObserveUBM = new
// BehaviorModelSink(visualizationUrl,
// signatureCreationStrategy);

// this.connectPorts(behaviorModelCreationStage.getOutputPort(),
// tIObserveUBM.getInputPort());
}

/**
* Get input port.
*
* @return input port
*/
public InputPort<Instances> getInputPort() {
return null; // this.clustering.getInputPort();
}
}
Expand Up @@ -15,12 +15,6 @@
***************************************************************************/
package org.iobserve.analysis.behavior.clustering.xmeans;

import kieker.common.configuration.Configuration;
import kieker.monitoring.core.controller.ReceiveUnfilteredConfiguration;

import teetime.framework.CompositeStage;
import teetime.framework.InputPort;

import org.iobserve.analysis.behavior.clustering.em.UserSessionModelAggregator;
import org.iobserve.analysis.behavior.filter.BehaviorModelPrepratationStage;
import org.iobserve.analysis.behavior.filter.UserSessionGeneratorCompositeStage;
Expand All @@ -34,6 +28,11 @@
import org.iobserve.stages.data.trace.EventBasedTrace;
import org.iobserve.stages.general.ConfigurationException;

import kieker.common.configuration.Configuration;
import kieker.monitoring.core.controller.ReceiveUnfilteredConfiguration;
import teetime.framework.CompositeStage;
import teetime.framework.InputPort;

/**
* @author Reiner Jung
*
Expand Down Expand Up @@ -77,9 +76,10 @@ public XMeansBehaviorCompositeStage(final Configuration configuration) throws Co
this.userSessionGeneratorCompositeStage = new UserSessionGeneratorCompositeStage(configuration);

final UserSessionModelAggregator userSessionModelAggregator = new UserSessionModelAggregator();
userSessionModelAggregator.declareActive();

final BehaviorModelPrepratationStage behaviorModelPreparation = new BehaviorModelPrepratationStage(modelGenerationFilter,
representativeStrategy, keepEmptyTransitions);
final BehaviorModelPrepratationStage behaviorModelPreparation = new BehaviorModelPrepratationStage(
modelGenerationFilter, representativeStrategy, keepEmptyTransitions);

/** aggregation setup. */
final String namePrefix = configuration.getStringProperty(XMeansBehaviorCompositeStage.NAME_PREFIX);
Expand Down
Expand Up @@ -77,6 +77,8 @@ private double calculateSumOfSquaredErrors() {

for (int i = 0; i < numberOfCentroids; i++) {
for (int j = 0; j < this.instances.numInstances(); j++) {
System.out.println("# inst.: " + this.instances.numInstances());
System.out.println("# cent.: " + numberOfCentroids);
if (this.assignments[j] == i) {
this.sumOfSquaredErrors += Math
.pow(euclideanDistance.distance(this.instances.instance(j), this.centroids.instance(i)), 2);
Expand Down

0 comments on commit cf8cc9b

Please sign in to comment.