use of weka.core.Instances in project iobserve-analysis by research-iobserve.
the class UserGroupExtraction method extractUserGroups.
/**
* Function to extract user groups.
*/
public void extractUserGroups() {
final ClusteringPrePostProcessing clusteringProcessing = new ClusteringPrePostProcessing();
final XMeansClustering xMeansClustering = new XMeansClustering();
ClusteringResults xMeansClusteringResults;
/**
* 1. Extraction of distinct system operations. Creates a list of the distinct operation
* signatures occurring within the entryCallSequenceModel. It is required to transform each
* user session to counts of its called operations. The counts are used to determine the
* similarity between the user sessions
*/
final List<String> listOfDistinctOperationSignatures = clusteringProcessing.getListOfDistinctOperationSignatures(this.entryCallSequenceModel.getUserSessions());
/**
* 2. Transformation to the call count model. Transforms the call sequences of the user
* sessions to a list of counts of calls that state the number of calls of each distinct
* operation signature for each user session
*/
final List<UserSessionAsCountsOfCalls> callCountModel = clusteringProcessing.getCallCountModel(this.entryCallSequenceModel.getUserSessions(), listOfDistinctOperationSignatures);
/**
* 3. Clustering of user sessions. Clustering of the user sessions whose behavior is
* represented as counts of their called operation signatures to obtain user groups
*/
final Instances instances = xMeansClustering.createInstances(callCountModel, listOfDistinctOperationSignatures);
/*
* The clustering is performed 5 times and the best result is taken. The quality of a
* clustering result is determined by the value of the sum of squared error (SSE) of the
* clustering. The lower the SSE is the better the clustering result.
*/
for (int i = 0; i < 5; i++) {
xMeansClusteringResults = xMeansClustering.clusterSessionsWithXMeans(instances, this.numberOfUserGroupsFromInputUsageModel, this.varianceOfUserGroups, i);
if (this.clusteringResults == null) {
this.clusteringResults = xMeansClusteringResults;
} else if (xMeansClusteringResults.getClusteringMetrics().getSumOfSquaredErrors() < this.clusteringResults.getClusteringMetrics().getSumOfSquaredErrors()) {
this.clusteringResults = xMeansClusteringResults;
}
}
/**
* 4. Obtaining the user groups' call sequence models. Creates for each cluster resp. user
* group its own entry call sequence model that exclusively contains its assigned user
* sessions
*/
final List<EntryCallSequenceModel> entryCallSequenceModelsOfXMeansClustering = clusteringProcessing.getForEachUserGroupAnEntryCallSequenceModel(this.clusteringResults, this.entryCallSequenceModel);
/**
* 5. Obtaining the user groups' workload intensity. Calculates and sets for each user group
* its specific workload intensity parameters
*/
clusteringProcessing.setTheWorkloadIntensityForTheEntryCallSequenceModels(entryCallSequenceModelsOfXMeansClustering, this.isClosedWorkload);
/**
* Sets the resulting entryCallSequenceModels that can be retrieved via the getter method
*/
this.entryCallSequenceModelsOfUserGroups = entryCallSequenceModelsOfXMeansClustering;
}
Aggregations