Search in sources :

Example 1 with UserGroupExtraction

use of org.iobserve.analysis.behavior.karlsruhe.UserGroupExtraction 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

UserGroupExtraction (org.iobserve.analysis.behavior.karlsruhe.UserGroupExtraction)1 UserSessionCollectionModel (org.iobserve.analysis.data.UserSessionCollectionModel)1 UserSession (org.iobserve.analysis.session.data.UserSession)1