-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathColocationPatternGroup.py
More file actions
31 lines (26 loc) · 1.68 KB
/
ColocationPatternGroup.py
File metadata and controls
31 lines (26 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from BinaryColocationPattern import BinaryColocationPattern
from GeneralColocationPattern import GeneralColocationPattern
class ColocationPatternGroup():
def __init__(self, m_basePointGrid, m_piThreshold, m_basePatternGroup = None):
if m_basePatternGroup is None:
self.patterns = {}
eventTypes = list(m_basePointGrid.pointIndex.keys())
for i in range(len(eventTypes)-1):
for j in range(i+1, len(eventTypes)):
colocationPattern = BinaryColocationPattern(list([eventTypes[i], eventTypes[j]]),
m_basePointGrid,
m_piThreshold)
if len(colocationPattern.MBR) > 0:
self.patterns[colocationPattern.TypeLabel] = colocationPattern
else:
patternLabels = list([m_basePatternGroup.Patterns.keys()])
for i in range(len(patternLabels)-1):
for j in range(i + 1, len(patternLabels)):
colocationPattern = GeneralColocationPattern(m_basePointGrid,
m_basePatternGroup.Patterns[patternLabels[i]],
m_basePatternGroup.Patterns[patternLabels[j]],
m_piThreshold)
if (colocationPattern.TypeNumber == 0):
continue
if (len(colocationPattern.MBR) > 0):
self.patterns[colocationPattern.TypeLabel] = colocationPattern