Parcourir la source

group by hardware ID

Xi Ruoyao il y a 5 ans
Parent
commit
2ebda8f01d
1 fichiers modifiés avec 9 ajouts et 1 suppressions
  1. 9 1
      main.py

+ 9 - 1
main.py

@@ -2,6 +2,7 @@ from sklearn.cluster import DBSCAN
 from sklearn import metrics
 import numpy as np
 import matplotlib.pyplot as plt
+from itertools import groupby
 
 import csv_parser
 import recog
@@ -9,7 +10,14 @@ import metric
 
 if __name__ == '__main__':
     data = csv_parser.parse_data_from_csv('test0714.csv')
-    entries = recog.recognize_entries(data)
+    groups = groupby(data, key = lambda x: x.hwid)
+    entries = []
+    for k, grp in groups:
+        data1 = list(grp)
+        entries1 = recog.recognize_entries(data)
+        for i in entries1:
+            entries.append(i)
+    print(entries)
     x = []
     for e in entries:
         x.append([e.lon, e.lat])