Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Troubled Cell Detection
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Laura Christine Kühle
Troubled Cell Detection
Commits
87e13049
Commit
87e13049
authored
2 years ago
by
Laura Christine Kühle
Browse files
Options
Downloads
Patches
Plain Diff
Added option to adjust outer fences using global mean for Boxplot method.
parent
6e7f124a
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Troubled_Cell_Detector.py
+15
-0
15 additions, 0 deletions
Troubled_Cell_Detector.py
with
15 additions
and
0 deletions
Troubled_Cell_Detector.py
+
15
−
0
View file @
87e13049
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
@author: Laura C. Kühle, Soraya Terrab (sorayaterrab)
@author: Laura C. Kühle, Soraya Terrab (sorayaterrab)
TODO: Introduce Adjusted Outer Fence method in Boxplot using global_mean
TODO: Introduce Adjusted Outer Fence method in Boxplot using global_mean
-> Done
TODO: Introduce overlapping cell for adjacent folds in Boxplot
TODO: Introduce overlapping cell for adjacent folds in Boxplot
TODO: Introduce lower/upper extreme outliers in Boxplot
TODO: Introduce lower/upper extreme outliers in Boxplot
(each cell is also checked for neighboring domains if existing)
(each cell is also checked for neighboring domains if existing)
...
@@ -339,6 +340,8 @@ class Boxplot(WaveletDetector):
...
@@ -339,6 +340,8 @@ class Boxplot(WaveletDetector):
Length of folds considered in one Boxplot.
Length of folds considered in one Boxplot.
whisker_len : int
whisker_len : int
Length of Boxplot whiskers.
Length of Boxplot whiskers.
adjust_outer_fences : bool
Flag whether outer fences should be adjusted using global mean.
"""
"""
def
_reset
(
self
,
config
):
def
_reset
(
self
,
config
):
...
@@ -355,6 +358,7 @@ class Boxplot(WaveletDetector):
...
@@ -355,6 +358,7 @@ class Boxplot(WaveletDetector):
# Unpack necessary configurations
# Unpack necessary configurations
self
.
_fold_len
=
config
.
pop
(
'
fold_len
'
,
16
)
self
.
_fold_len
=
config
.
pop
(
'
fold_len
'
,
16
)
self
.
_whisker_len
=
config
.
pop
(
'
whisker_len
'
,
3
)
self
.
_whisker_len
=
config
.
pop
(
'
whisker_len
'
,
3
)
self
.
_adjust_outer_fences
=
config
.
pop
(
'
adjust_outer_fences
'
,
True
)
def
_get_cells
(
self
,
multiwavelet_coeffs
,
projection
):
def
_get_cells
(
self
,
multiwavelet_coeffs
,
projection
):
"""
Calculates troubled cells using multiwavelet coefficients.
"""
Calculates troubled cells using multiwavelet coefficients.
...
@@ -374,6 +378,12 @@ class Boxplot(WaveletDetector):
...
@@ -374,6 +378,12 @@ class Boxplot(WaveletDetector):
"""
"""
indexed_coeffs
=
[[
multiwavelet_coeffs
[
0
,
i
],
i
]
indexed_coeffs
=
[[
multiwavelet_coeffs
[
0
,
i
],
i
]
for
i
in
range
(
self
.
_mesh
.
num_grid_cells
)]
for
i
in
range
(
self
.
_mesh
.
num_grid_cells
)]
# max_multiwavelets = [multiwavelet_coeffs[0, i]
# for i in range(self._mesh.num_grid_cells)]
# global_mean_old = np.mean(abs(np.array(max_multiwavelets)))
if
self
.
_adjust_outer_fences
:
global_mean
=
np
.
mean
(
abs
(
np
.
array
(
indexed_coeffs
)[:,
0
]))
# print(global_mean == global_mean_old)
if
self
.
_mesh
.
num_grid_cells
<
self
.
_fold_len
:
if
self
.
_mesh
.
num_grid_cells
<
self
.
_fold_len
:
self
.
_fold_len
=
self
.
_mesh
.
num_grid_cells
self
.
_fold_len
=
self
.
_mesh
.
num_grid_cells
...
@@ -400,6 +410,11 @@ class Boxplot(WaveletDetector):
...
@@ -400,6 +410,11 @@ class Boxplot(WaveletDetector):
upper_bound
=
third_quartile
\
upper_bound
=
third_quartile
\
+
self
.
_whisker_len
*
(
third_quartile
-
first_quartile
)
+
self
.
_whisker_len
*
(
third_quartile
-
first_quartile
)
# Adjust outer fences if flag is set
if
self
.
_adjust_outer_fences
:
lower_bound
=
min
(
-
global_mean
,
lower_bound
)
upper_bound
=
max
(
global_mean
,
upper_bound
)
# Check for lower extreme outliers and add respective cells
# Check for lower extreme outliers and add respective cells
for
cell
in
sorted_fold
:
for
cell
in
sorted_fold
:
if
cell
[
0
]
<
lower_bound
:
if
cell
[
0
]
<
lower_bound
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment