Skip to content

Commit

Permalink
improving with union
Browse files Browse the repository at this point in the history
  • Loading branch information
elro77 committed Dec 15, 2021
1 parent e5123fe commit bdae8cb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
16 changes: 14 additions & 2 deletions DBSCAN_Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
My clustering 178 seconds
== Version 1.03,
== Version 1.03, using Dan's euclidean distance, saving the vectors for each grid group
for 3000 points -> optimal clustering 0.287 seconds
My clustering 1.87 seconds
Expand All @@ -56,6 +56,18 @@
My clustering 19.83 seconds
for 50,000 points -> optimal clustering 32.14 seconds
My clustering very long time seconds
== Version 1.04, decreasing number pf iterations using group union
for 5000 points -> optimal clustering 0.605 seconds
My clustering 0.93 seconds
for 10,000 points -> optimal clustering 2.72 seconds
My clustering 3.57 seconds
for 50,000 points -> optimal clustering 32.14 seconds
My clustering 90.86 time seconds
"""

Expand All @@ -69,7 +81,7 @@



testArray = vectorsArray[5000:10000]
testArray = vectorsArray[0:50000]
#====== Sklearn =================
#the sklearn clustering takes 120 seconds to accomplish
#return an array where each index is the vector(point) and value is it clustering
Expand Down
8 changes: 4 additions & 4 deletions MyDBSCAN.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,13 @@ def initgridDictionaryVectors(self, data):
self.gridDictionaryIndexes.update({currentKey : []})
self.gridDictionaryVectors[currentKey].append(data[pIndex])
self.gridDictionaryIndexes[currentKey].append(pIndex)
t = time.time()
#t = time.time()
self.zipGrid()
elapsed = time.time() - t
print("zip grid time: ",elapsed)
#elapsed = time.time() - t
#print("zip grid time: ",elapsed)




def initGraph(self, data):
cnt = 0
for key in self.actualKeys:
Expand All @@ -145,6 +144,7 @@ def initGraph(self, data):
result = self.dist(np.array(self.gridDictionaryVectors[key]))
elapsed = time.time() - t
print("dist calc : ",elapsed)
t = time.time()
for pIndex in range(len(self.gridDictionaryIndexes[key])):
for qIndex in range(pIndex, len(self.gridDictionaryIndexes[key])):
if result[pIndex, qIndex] <= self.eps:
Expand Down

0 comments on commit bdae8cb

Please sign in to comment.