Skip to content

Commit 6516ac3

Browse files
author
Reiner Jung
committed
added initial setup for model comparison.
1 parent 9e3213e commit 6516ac3

21 files changed

+1319
-218
lines changed

analysis/src/main/java/org/iobserve/analysis/cdoruserbehavior/clustering/IVectorQuantizationClustering.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
import weka.core.Instances;
2424

2525
/**
26-
* interface for a clustering usable by {@link TVectorQuantizationClustering}
26+
* interface for a clustering usable by {@link TVectorQuantizationClustering}.
2727
*
2828
* @author Christoph Dornieden
2929
*
3030
*/
3131
public interface IVectorQuantizationClustering extends IClustering {
3232
/**
33-
* get cluster centers of all clusters
33+
* get cluster centers of all clusters.
3434
*
3535
* @param instances
3636
* instances to be clustered

analysis/src/main/java/org/iobserve/analysis/cdoruserbehavior/clustering/XMeansClustering.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import weka.core.NormalizableDistance;
2727

2828
/**
29-
* xmeans clustering for TClustering
29+
* xmeans clustering for TClustering.
3030
*
3131
* @author Christoph Dornieden
3232
*
@@ -37,7 +37,7 @@ public class XMeansClustering implements IVectorQuantizationClustering {
3737
private final NormalizableDistance distanceMetric;
3838

3939
/**
40-
* constructor
40+
* constructor.
4141
*
4242
* @param expectedUserGroups
4343
* number of expected user groups
@@ -48,16 +48,16 @@ public class XMeansClustering implements IVectorQuantizationClustering {
4848
*/
4949
public XMeansClustering(final int expectedUserGroups, final int variance,
5050
final NormalizableDistance distanceMetric) {
51-
this.minClusters = (expectedUserGroups - variance) < 2 ? 1 : expectedUserGroups - variance;
52-
this.maxClusters = (expectedUserGroups + variance) < 2 ? 2 : expectedUserGroups + variance;
51+
this.minClusters = expectedUserGroups - variance < 2 ? 1 : expectedUserGroups - variance;
52+
this.maxClusters = expectedUserGroups + variance < 2 ? 2 : expectedUserGroups + variance;
5353
this.distanceMetric = distanceMetric;
5454
}
5555

5656
@Override
5757
public Optional<ClusteringResults> clusterInstances(final Instances instances) {
5858
Optional<ClusteringResults> clusteringResults = Optional.empty();
5959

60-
// Cluster multiple times to reduce the impact of the initial k of the k-means
60+
/** Cluster multiple times to reduce the impact of the initial k of the k-means. */
6161
for (int i = 0; i < 5; i++) {
6262

6363
final Optional<ClusteringResults> tempClusteringResults = this.getClusteringResults(instances);
@@ -84,10 +84,10 @@ private Optional<ClusteringResults> getClusteringResults(final Instances instanc
8484
try {
8585
xMeansClusterer.buildClusterer(instances);
8686

87-
// **************************************************************
88-
// Code used from org.iobserve.analysis.userbehavior.XMeansClustering
89-
// to use org.iobserve.analysis.userbehavior.ClusteringResults
90-
// **************************************************************
87+
/**
88+
* Code used from org.iobserve.analysis.userbehavior.XMeansClustering to use
89+
* org.iobserve.analysis.userbehavior.ClusteringResults
90+
*/
9191
int[] clustersize = null;
9292
final int[] assignments = new int[instances.numInstances()];
9393
clustersize = new int[xMeansClusterer.getClusterCenters().numInstances()];
@@ -102,7 +102,6 @@ private Optional<ClusteringResults> getClusteringResults(final Instances instanc
102102

103103
final ClusteringResults xMeansClusteringResults = new ClusteringResults("X-Means",
104104
xMeansClusterer.getClusterCenters().numInstances(), assignments, clusteringMetrics);
105-
// ****
106105

107106
return Optional.of(xMeansClusteringResults);
108107

analysis/src/main/java/org/iobserve/analysis/cdoruserbehavior/filter/TBehaviorModelCreation.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import weka.core.Instances;
3333

3434
/**
35+
* Create a behavior model from Weka instances.
3536
*
3637
* @author Christoph Dornieden
3738
*
@@ -71,7 +72,7 @@ public OutputPort<BehaviorModel> getOutputPort() {
7172
}
7273

7374
/**
74-
* create a BehaviorModel from Instance
75+
* create a BehaviorModel from Instance.
7576
*
7677
* @param instances
7778
* instances containing the attribute names
@@ -113,7 +114,7 @@ private Optional<BehaviorModel> createBehaviorModel(final Instances instances, f
113114
}
114115

115116
/**
116-
* Does the attribute name represent an edge?
117+
* Test whether the given attribute name represent an edge.
117118
*
118119
* @param name
119120
* attribute name
@@ -124,7 +125,7 @@ private boolean matchEdge(final String name) {
124125
}
125126

126127
/**
127-
* Does the attribute name represent a node?
128+
* Test whether the attribute name represent a node.
128129
*
129130
* @param name
130131
* attribute name
@@ -135,7 +136,7 @@ private boolean matchNode(final String name) {
135136
}
136137

137138
/**
138-
* does the pattern matches the start of the string
139+
* Does the pattern matches the start of the string.
139140
*
140141
* @param pattern
141142
* pattern
@@ -150,7 +151,7 @@ private boolean matchStart(final Pattern pattern, final String string) {
150151
}
151152

152153
/**
153-
* creates an edge from an edge representing attribute string and value
154+
* Creates an edge from an edge representing attribute string and value.
154155
*
155156
* @param name
156157
* attribute name
@@ -181,7 +182,7 @@ private Optional<EntryCallEdge> createEdge(final String name, final Double value
181182
}
182183

183184
/**
184-
* creates an node from a node representing attribute string and value
185+
* Creates an node from a node representing attribute string and value.
185186
*
186187
* @param name
187188
* attribute name
@@ -208,7 +209,7 @@ private Optional<EntryCallNode> createNode(final String name, final Double value
208209
}
209210

210211
/**
211-
* splits the signature
212+
* Splits the signature.
212213
*
213214
* @param indicator
214215
* indicator

analysis/src/main/java/org/iobserve/analysis/cdoruserbehavior/filter/TBehaviorModelPreperation.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ protected void execute(final Object object) {
7676
}
7777

7878
/**
79-
* execute case object instanceof EntryCallSequenceModel.
79+
* Execute case object instanceof EntryCallSequenceModel.
8080
*
8181
* @param entryCallSequenceModel
8282
* entryCallSequenceModel
@@ -117,7 +117,7 @@ private void executeEntryCallSequenceModel(final EntryCallSequenceModel entryCal
117117
}
118118

119119
/**
120-
* execute case object instanceof BehaviorModelTable.
120+
* Execute case object instanceof BehaviorModelTable.
121121
*
122122
* @param behaviorModelTable
123123
* behaviorModelTable

analysis/src/main/java/org/iobserve/analysis/cdoruserbehavior/filter/models/EntryCallEdge.java

Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package org.iobserve.analysis.cdoruserbehavior.filter.models;
1717

1818
/**
19-
* Represents the transition between an entry call
19+
* Represents the transition between an entry call.
2020
*
2121
* @author Christoph Dornieden
2222
*
@@ -30,7 +30,7 @@ public class EntryCallEdge {
3030
private double calls;
3131

3232
/**
33-
* constructor
33+
* constructor.
3434
*/
3535
public EntryCallEdge() {
3636
this.source = null;
@@ -39,7 +39,7 @@ public EntryCallEdge() {
3939
}
4040

4141
/**
42-
* constructor
42+
* constructor.
4343
*
4444
* @param source
4545
* source node
@@ -53,7 +53,7 @@ public EntryCallEdge(final EntryCallNode source, final EntryCallNode target) {
5353
}
5454

5555
/**
56-
* constructor
56+
* constructor.
5757
*
5858
* @param source
5959
* source node
@@ -69,14 +69,14 @@ public EntryCallEdge(final EntryCallNode source, final EntryCallNode target, fin
6969
}
7070

7171
/**
72-
* increment calls
72+
* increment calls.
7373
*/
7474
public void incrementCalls() {
7575
this.calls = this.calls < 0 ? 0 : this.calls + 1;
7676
}
7777

7878
/**
79-
* decrement calls
79+
* decrement calls.
8080
*/
8181
public void decrementCalls() {
8282
this.calls = this.calls < 1 ? 0 : this.calls - 1;
@@ -92,7 +92,7 @@ public boolean equals(final Object obj) {
9292
if (obj instanceof EntryCallEdge) {
9393

9494
final EntryCallEdge edge = (EntryCallEdge) obj;
95-
return (this.getSource().equals(edge.getSource())) && (this.getTarget().equals(edge.getTarget()));
95+
return this.getSource().equals(edge.getSource()) && this.getTarget().equals(edge.getTarget());
9696

9797
} else {
9898
return super.equals(obj);
@@ -104,65 +104,32 @@ public int hashCode() {
104104
return super.hashCode();
105105
}
106106

107-
/**
108-
* getter
109-
*
110-
* @return source node
111-
*/
112107
public EntryCallNode getSource() {
113108
return this.source;
114109
}
115110

116-
/**
117-
* setter
118-
*
119-
* @param source
120-
* target node
121-
*/
122111
public void setSource(final EntryCallNode source) {
123112
this.source = source;
124113
}
125114

126-
/**
127-
* getter
128-
*
129-
* @return target node
130-
*/
131115
public EntryCallNode getTarget() {
132116
return this.target;
133117
}
134118

135-
/**
136-
* setter
137-
*
138-
* @param target
139-
* target node
140-
*/
141119
public void setTarget(final EntryCallNode target) {
142120
this.target = target;
143121
}
144122

145-
/**
146-
* getter
147-
*
148-
* @return calls
149-
*/
150123
public double getCalls() {
151124
return this.calls;
152125
}
153126

154-
/**
155-
* setter
156-
*
157-
* @param calls
158-
* calls
159-
*/
160127
public void setCalls(final double calls) {
161128
this.calls = calls < 0 ? 0 : calls;
162129
}
163130

164131
/**
165-
* add calls to the edge
132+
* add calls to the edge.
166133
*
167134
* @param calls
168135
* calls

analysis/src/main/java/org/iobserve/analysis/cdoruserbehavior/filter/models/EntryCallNode.java

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import org.iobserve.analysis.cdoruserbehavior.util.SingleOrNoneCollector;
2323

2424
/**
25-
* Represents the an entry call
25+
* Represents the an entry call.
2626
*
2727
* @author Christoph Dornieden
2828
*
@@ -33,7 +33,7 @@ public class EntryCallNode {
3333
private final Set<CallInformation> entryCallInformations;
3434

3535
/**
36-
* constructor
36+
* constructor.
3737
*
3838
* @param signature
3939
* signature
@@ -44,7 +44,7 @@ public EntryCallNode(final String signature) {
4444
}
4545

4646
/**
47-
* adds call information with signatures not present in the entry call information set
47+
* adds call information with signatures not present in the entry call information set.
4848
*
4949
* @param callInformations
5050
* callInformations
@@ -54,7 +54,7 @@ public void mergeInformation(final Set<CallInformation> callInformations) {
5454
}
5555

5656
/**
57-
* adds a call information with a signature not present in the entry call information set
57+
* adds a call information with a signature not present in the entry call information set.
5858
*
5959
* @param callInformation
6060
* callInformation
@@ -91,20 +91,10 @@ public int hashCode() {
9191
return super.hashCode();
9292
}
9393

94-
/**
95-
* getter
96-
*
97-
* @return the signature
98-
*/
9994
public String getSignature() {
10095
return this.signature;
10196
}
10297

103-
/**
104-
* getter
105-
*
106-
* @return the entryCallInformation
107-
*/
10898
public Set<CallInformation> getEntryCallInformation() {
10999
return this.entryCallInformations;
110100
}

0 commit comments

Comments
 (0)