From 6b260fc32264d89db32fdb745cd4f7c58d8acced Mon Sep 17 00:00:00 2001 From: rtrimana Date: Sat, 4 Jan 2020 11:03:34 -0800 Subject: [PATCH] Adding a parameter to easily change epsilon and cluster bounds. --- .../java/edu/uci/iotproject/SignatureGenerator.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Code/Projects/PacketLevelSignatureExtractor/src/main/java/edu/uci/iotproject/SignatureGenerator.java b/Code/Projects/PacketLevelSignatureExtractor/src/main/java/edu/uci/iotproject/SignatureGenerator.java index 15a79b7..ea3e39b 100644 --- a/Code/Projects/PacketLevelSignatureExtractor/src/main/java/edu/uci/iotproject/SignatureGenerator.java +++ b/Code/Projects/PacketLevelSignatureExtractor/src/main/java/edu/uci/iotproject/SignatureGenerator.java @@ -47,6 +47,10 @@ public class SignatureGenerator { * Directory for logging. */ private static String LOG_DIRECTORY = "./"; + /** + * Multiplier for cluster bounds. + */ + private static float CLUSTER_BOUNDS_MULTIPLIER = 0.1f; public static void main(String[] args) throws PcapNativeException, NotOpenException, EOFException, TimeoutException, UnknownHostException, IOException { @@ -214,10 +218,8 @@ public class SignatureGenerator { // Perform clustering on conversation logged as part of all ON events. // Calculate number of events per type (only ON/only OFF), which means half of the number of all timestamps. int numberOfEventsPerType = triggerTimes.size() / 2; -// int lowerBound = numberOfEventsPerType - (int)(numberOfEventsPerType * 0.1); -// int upperBound = numberOfEventsPerType + (int)(numberOfEventsPerType * 0.1); - int lowerBound = numberOfEventsPerType - (int)(numberOfEventsPerType * 0.2); - int upperBound = numberOfEventsPerType + (int)(numberOfEventsPerType * 0.2); + int lowerBound = numberOfEventsPerType - (int)(numberOfEventsPerType * CLUSTER_BOUNDS_MULTIPLIER); + int upperBound = numberOfEventsPerType + (int)(numberOfEventsPerType * CLUSTER_BOUNDS_MULTIPLIER); int minPts = lowerBound; DBSCANClusterer onClusterer = new DBSCANClusterer<>(eps, minPts); List> onClusters = onClusterer.cluster(onPairs); -- 2.34.1