projects
/
pingpong.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implementing relaxed matching for layer 2 and layer 3.
[pingpong.git]
/
python_ml
/
plotting-dbscan-complete.py
diff --git
a/python_ml/plotting-dbscan-complete.py
b/python_ml/plotting-dbscan-complete.py
index 55d5af4638306220119dcd8ef87f73b991023ed4..a2baa902c63104e52c02a2c6d24b07f4c5f60760 100644
(file)
--- a/
python_ml/plotting-dbscan-complete.py
+++ b/
python_ml/plotting-dbscan-complete.py
@@
-13,8
+13,8
@@
fig.set_size_inches(7, 7)
# TODO: Just change the following path and filename
# when needed to read from a different file
path = "/scratch/July-2018/Pairs2/"
# TODO: Just change the following path and filename
# when needed to read from a different file
path = "/scratch/July-2018/Pairs2/"
-device1 = "
kwikset
-on"
-device2 = "
kwikset
-off"
+device1 = "
alexa2
-on"
+device2 = "
alexa2
-off"
filename1 = device1 + ".txt"
filename2 = device2 + ".txt"
filename1 = device1 + ".txt"
filename2 = device2 + ".txt"
@@
-38,7
+38,7
@@
X = np.array(pairsArr);
# Compute DBSCAN
# eps = distances
# min_samples = minimum number of members of a cluster
# Compute DBSCAN
# eps = distances
# min_samples = minimum number of members of a cluster
-db = DBSCAN(eps=
3
0, min_samples=trig - 5).fit(X)
+db = DBSCAN(eps=
1
0, min_samples=trig - 5).fit(X)
core_samples_mask = np.zeros_like(db.labels_, dtype=bool)
core_samples_mask[db.core_sample_indices_] = True
labels = db.labels_
core_samples_mask = np.zeros_like(db.labels_, dtype=bool)
core_samples_mask[db.core_sample_indices_] = True
labels = db.labels_
@@
-76,7
+76,7
@@
for pair in pairsArr:
else:
# Only print the frequency when this is a real cluster
plt.text(pair[0], pair[1], str(pair[0]) + ", " + str(pair[1]) +
else:
# Only print the frequency when this is a real cluster
plt.text(pair[0], pair[1], str(pair[0]) + ", " + str(pair[1]) +
- "\nFreq:
" + str(labels.tolist().count(labels[count])), fontsize=10)
+ "\nFreq:" + str(labels.tolist().count(labels[count])), fontsize=10)
count = count + 1
#====================================================================================================
count = count + 1
#====================================================================================================
@@
-138,7
+138,7
@@
for pair in pairsArr:
else:
# Only print the frequency when this is a real cluster
plt.text(pair[0], pair[1], str(pair[0]) + ", " + str(pair[1]) +
else:
# Only print the frequency when this is a real cluster
plt.text(pair[0], pair[1], str(pair[0]) + ", " + str(pair[1]) +
- "\nFreq:
" + str(labels.tolist().count(labels[count])), fontsize=10)
+ "\nFreq:" + str(labels.tolist().count(labels[count])), fontsize=10)
count = count + 1
count = count + 1