use of org.iobserve.analysis.data.EntryCallSequenceModel in project iobserve-analysis by research-iobserve.
the class ClusteringPrePostProcessing method getForEachUserGroupAnEntryCallSequenceModel.
/**
* It creates for each cluster(user group) its own entryCallSequenceModel. For that, each
* entryCallSequenceModel receives exclusively the user group's assigned user sessions obtained
* via the clustering. Additionally each entryCallSequenceModel receives the user group's
* occurrence likelihood within the considered user sessions.
*
* @param clusteringResults
* hold the assignments of the clustering and the number of clusters
* @param callSequenceModel
* is the input entryCallSequenceModel that holds all user sessions
* @return for each cluster one entryCallSequenceModel. Each contains exclusively the cluster's
* assigned user sessions
*/
public List<EntryCallSequenceModel> getForEachUserGroupAnEntryCallSequenceModel(final ClusteringResults clusteringResults, final EntryCallSequenceModel callSequenceModel) {
final int numberOfClusters = clusteringResults.getNumberOfClusters();
final int[] assignments = clusteringResults.getAssignments();
final List<EntryCallSequenceModel> entryCallSequenceModels = new ArrayList<>(numberOfClusters);
final double countOfAbsoluteUserSessions = callSequenceModel.getUserSessions().size();
for (int k = 0; k < numberOfClusters; k++) {
final List<UserSession> sessions = new ArrayList<>();
int instanceNumber = 0;
double countOfAssigendUserSessions = 0;
for (final int clusterNum : assignments) {
if (clusterNum == k) {
sessions.add(callSequenceModel.getUserSessions().get(instanceNumber));
countOfAssigendUserSessions++;
}
instanceNumber++;
}
if (sessions.isEmpty()) {
continue;
}
final double relativeFrequencyOfUserGroup = countOfAssigendUserSessions / countOfAbsoluteUserSessions;
entryCallSequenceModels.add(new EntryCallSequenceModel(sessions, relativeFrequencyOfUserGroup));
}
return entryCallSequenceModels;
}
use of org.iobserve.analysis.data.EntryCallSequenceModel in project iobserve-analysis by research-iobserve.
the class ClusteringPrePostProcessing method setTheWorkloadIntensityForTheEntryCallSequenceModels.
/**
* It calculates and sets for each entryCallSequenceModel its specific workload intensity. For
* that it calculates an open or a closed workload and adds it to its entryCallSequenceModel.
*
* @param entryCallSequenceModels
* are the entryCallSequenceModels of the detected user groups
* @param isClosedWorkload
* states whether a closed or an open workload is requested by the user
*/
public void setTheWorkloadIntensityForTheEntryCallSequenceModels(final List<EntryCallSequenceModel> entryCallSequenceModels, final boolean isClosedWorkload) {
for (final EntryCallSequenceModel entryCallSequenceModel : entryCallSequenceModels) {
final WorkloadIntensity workloadIntensity = new WorkloadIntensity();
if (isClosedWorkload) {
this.calculateTheNumberOfConcurrentUsers(entryCallSequenceModel.getUserSessions(), workloadIntensity);
} else {
this.calculateInterarrivalTime(entryCallSequenceModel.getUserSessions(), workloadIntensity);
}
entryCallSequenceModel.setWorkloadIntensity(workloadIntensity);
}
}
use of org.iobserve.analysis.data.EntryCallSequenceModel in project iobserve-analysis by research-iobserve.
the class ClusteringEvaluation method performClustering.
/**
* Executes the approach's extraction of user groups process and counts the assignments of user
* sessions of each user group within each cluster to be able to calculate the misclassification
* rate. Returns the sum of squared error of the clustering
*
* @return the sum of squared error of the executed clustering
* @throws IOException
*/
private double performClustering() throws IOException {
final UserGroupExtraction userGroupExtraction = new UserGroupExtraction(this.entryCallSequenceModel, 3, ClusteringEvaluation.VARIANCE_VALUE, true);
userGroupExtraction.extractUserGroups();
final List<EntryCallSequenceModel> entryCallSequenceModelsOfUserGroups = userGroupExtraction.getEntryCallSequenceModelsOfUserGroups();
this.listOfClusterAssignmentsCounter = new ArrayList<>();
for (int i = 0; i < entryCallSequenceModelsOfUserGroups.size(); i++) {
final ClusterAssignmentsCounter clusterAssignments = new ClusterAssignmentsCounter();
this.listOfClusterAssignmentsCounter.add(clusterAssignments);
}
int index = 0;
for (final EntryCallSequenceModel entryCallSequence : entryCallSequenceModelsOfUserGroups) {
for (final UserSession userSession : entryCallSequence.getUserSessions()) {
if (userSession.getSessionId().equals(ClusteringEvaluation.CUSTOMER_TAG)) {
this.listOfClusterAssignmentsCounter.get(index).increaseNumberOfUserGroupCustomer();
} else if (userSession.getSessionId().equals(ClusteringEvaluation.STORE_MANAGER_TAG)) {
this.listOfClusterAssignmentsCounter.get(index).increaseNumberOfUserGroupStoreManager();
} else if (userSession.getSessionId().equals(ClusteringEvaluation.STOCK_MANAGER_TAG)) {
this.listOfClusterAssignmentsCounter.get(index).increaseNumberOfUserGroupStockManager();
}
}
index++;
}
return userGroupExtraction.getClusteringResults().getClusteringMetrics().getSumOfSquaredErrors();
}
use of org.iobserve.analysis.data.EntryCallSequenceModel in project iobserve-analysis by research-iobserve.
the class TEntryCallSequenceWithPCM method execute.
@Override
protected void execute(final PayloadAwareEntryCallEvent event) {
/**
* check if operationEvent is from an known object
*/
if (this.correspondenceModel.containsCorrespondent(event.getClassSignature(), event.getOperationSignature())) {
// add the event to the corresponding user session
// in case the user session is not yet available, create one
final String userSessionId = UserSession.createUserSessionId(event);
UserSession userSession = this.sessions.get(userSessionId);
if (userSession == null) {
userSession = new UserSession(event.getHostname(), event.getSessionId());
this.sessions.put(userSessionId, userSession);
}
// do not sort since TEntryEventSequence will sort any ways
userSession.add(event, false);
// collect all user sessions which have more elements as a defined threshold and send
// them
// to the next filter
final List<UserSession> listToSend = this.sessions.values().stream().filter(session -> session.size() > TEntryCallSequenceWithPCM.USER_SESSION_THRESHOLD).collect(Collectors.toList());
if (!listToSend.isEmpty()) {
this.outputPort.send(new EntryCallSequenceModel(listToSend));
}
}
}
use of org.iobserve.analysis.data.EntryCallSequenceModel in project iobserve-analysis by research-iobserve.
the class TBehaviorModelPreperation method execute.
@Override
protected void execute(final Object object) {
if (object instanceof EntryCallSequenceModel) {
final EntryCallSequenceModel entryCallSequenceModel = (EntryCallSequenceModel) object;
this.executeEntryCallSequenceModel(entryCallSequenceModel);
} else if (object instanceof BehaviorModelTable) {
final BehaviorModelTable modelTable = (BehaviorModelTable) object;
this.executeBehaviorModelTable(modelTable);
} else {
TBehaviorModelPreperation.LOGGER.error("input is nether of type EntryCallSequenceModel nor BehaviorModelTable");
}
}
Aggregations