Search in sources :

Example 21 with UserSessionCollectionModel

use of org.iobserve.analysis.data.UserSessionCollectionModel 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<UserSessionCollectionModel> 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 UserSessionCollectionModel 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();
}
Also used : UserSessionCollectionModel(org.iobserve.analysis.data.UserSessionCollectionModel) UserGroupExtraction(org.iobserve.analysis.behavior.karlsruhe.UserGroupExtraction) UserSession(org.iobserve.analysis.session.data.UserSession)

Aggregations

UserSessionCollectionModel (org.iobserve.analysis.data.UserSessionCollectionModel)21 UserSession (org.iobserve.analysis.session.data.UserSession)8 ReferenceElements (org.iobserve.analysis.test.userbehavior.ReferenceElements)8 UsageModel (org.palladiosimulator.pcm.usagemodel.UsageModel)8 ScenarioBehaviour (org.palladiosimulator.pcm.usagemodel.ScenarioBehaviour)7 UsageScenario (org.palladiosimulator.pcm.usagemodel.UsageScenario)7 EntryCallEvent (org.iobserve.stages.general.data.EntryCallEvent)6 AbstractUserAction (org.palladiosimulator.pcm.usagemodel.AbstractUserAction)6 Start (org.palladiosimulator.pcm.usagemodel.Start)6 Stop (org.palladiosimulator.pcm.usagemodel.Stop)6 ArrayList (java.util.ArrayList)5 OperationSignature (org.palladiosimulator.pcm.repository.OperationSignature)5 EntryLevelSystemCall (org.palladiosimulator.pcm.usagemodel.EntryLevelSystemCall)5 PCMRandomVariable (org.palladiosimulator.pcm.core.PCMRandomVariable)4 Loop (org.palladiosimulator.pcm.usagemodel.Loop)4 List (java.util.List)3 Repository (org.palladiosimulator.pcm.repository.Repository)3 HashMap (java.util.HashMap)2 Branch (org.palladiosimulator.pcm.usagemodel.Branch)2 BranchTransition (org.palladiosimulator.pcm.usagemodel.BranchTransition)2