Skip to content
Snippets Groups Projects
Commit 1631565e authored by Laura Christine Kühle's avatar Laura Christine Kühle
Browse files

Added option to overlap folds for Boxplot method.

parent 87e13049
Branches
No related tags found
No related merge requests found
......@@ -4,12 +4,12 @@
TODO: Introduce Adjusted Outer Fence method in Boxplot using global_mean
-> Done
TODO: Introduce overlapping cell for adjacent folds in Boxplot
TODO: Introduce overlapping cells for adjacent folds in Boxplot -> Done
TODO: Extract fold computing from TC checking
TODO: Introduce lower/upper extreme outliers in Boxplot
(each cell is also checked for neighboring domains if existing)
TODO: Determine max_value for Theoretical only over highest degree
TODO: Check if indexing in wavelets is correct
TODO: Extract fold computing from TC checking
TODO: Add ThresholdDetector
TODO: Add TC condition to only flag cell if left-adjacent one is flagged as
well (remove this condition)
......@@ -342,6 +342,8 @@ class Boxplot(WaveletDetector):
Length of Boxplot whiskers.
adjust_outer_fences : bool
Flag whether outer fences should be adjusted using global mean.
num_overlapping_cells : int
Number of cells overlapping with adjacent folds.
"""
def _reset(self, config):
......@@ -359,6 +361,7 @@ class Boxplot(WaveletDetector):
self._fold_len = config.pop('fold_len', 16)
self._whisker_len = config.pop('whisker_len', 3)
self._adjust_outer_fences = config.pop('adjust_outer_fences', True)
self._num_overlapping_cells = config.pop('num_overlapping_cells', 1)
def _get_cells(self, multiwavelet_coeffs, projection):
"""Calculates troubled cells using multiwavelet coefficients.
......@@ -392,8 +395,11 @@ class Boxplot(WaveletDetector):
troubled_cells = []
for fold in range(num_folds):
sorted_fold = sorted(indexed_coeffs[fold * self._fold_len:
(fold+1) * self._fold_len])
indices = np.array([i % len(indexed_coeffs) for i in range(
fold * self._fold_len - self._num_overlapping_cells,
(fold+1) * self._fold_len + self._num_overlapping_cells)])
sorted_fold = sorted(np.array(indexed_coeffs)[indices],
key=lambda x: x[0])
boundary_index = self._fold_len//4
balance_factor = self._fold_len/4.0 - boundary_index
......@@ -422,7 +428,7 @@ class Boxplot(WaveletDetector):
else:
break
# Check for lower extreme outliers and add respective cells
# Check for upper extreme outliers and add respective cells
for cell in sorted_fold[::-1][:]:
if cell[0] > upper_bound:
troubled_cells.append(cell[1])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment