Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SaQC
Manage
Activity
Members
Labels
Plan
Issues
35
Issue boards
Milestones
Wiki
Code
Merge requests
8
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
rdm-software
SaQC
Commits
d1c14115
Commit
d1c14115
authored
4 years ago
by
Juliane Geller
Browse files
Options
Downloads
Patches
Plain Diff
docu for flagDriftScale
parent
fb03a2b9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!193
Release 1.4
,
!188
Release 1.4
,
!138
WIP: Detect and reset offset
Pipeline
#9854
passed with stage
in 6 minutes and 20 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
saqc/funcs/functions.py
+57
-0
57 additions, 0 deletions
saqc/funcs/functions.py
with
57 additions
and
0 deletions
saqc/funcs/functions.py
+
57
−
0
View file @
d1c14115
...
...
@@ -1036,6 +1036,63 @@ def flagDriftScale(data, field, flagger, fields_scale1, fields_scale2, segment_f
metric
=
lambda
x
,
y
:
scipy
.
spatial
.
distance
.
pdist
(
np
.
array
([
x
,
y
]),
metric
=
'
cityblock
'
)
/
len
(
x
),
linkage_method
=
'
single
'
,
**
kwargs
):
"""
The function transforms variables with different scales to one single scale and then flags value courses that
significantly deviate from a group of normal value courses. The scaling transformation is performed via linear
regression. The remaining steps are performed analogously to flagDriftFromNorm. The documentation of
flagDriftFromNorm gives a more detailed presentation of the remaining steps.
Parameters
----------
data : dios.DictOfSeries
A dictionary of pandas.Series, holding all the data.
field : str
A dummy parameter.
flagger : saqc.flagger
A flagger object, holding flags and additional informations related to `data`.
fields_scale1 : str
List of fieldnames in data to be included into the flagging process which are scaled according to scaling
scheme 1.
fields_scale2 : str
List of fieldnames in data to be included into the flagging process which are scaled according to scaling
scheme 2.
segment_freq : str
An offset string, determining the size of the seperate datachunks that the algorihm is to be piecewise
applied on.
norm_spread : float
A parameter limiting the maximum
"
spread
"
of the timeseries, allowed in the
"
normal
"
group. See Notes section
for more details.
norm_frac : float, default 0.5
Has to be in [0,1]. Determines the minimum percentage of variables, the
"
normal
"
group has to comprise to be the
normal group actually. The higher that value, the more stable the algorithm will be with respect to false
positives. Also, nobody knows what happens, if this value is below 0.5.
metric : Callable[(numpyp.array, numpy-array), float]
A distance function. It should be a function of 2 1-dimensional arrays and return a float scalar value.
This value is interpreted as the distance of the two input arrays. The default is the averaged manhatten metric.
See the Notes section to get an idea of why this could be a good choice.
linkage_method : {
"
single
"
,
"
complete
"
,
"
average
"
,
"
weighted
"
,
"
centroid
"
,
"
median
"
,
"
ward
"
}, default
"
single
"
The linkage method used for hierarchical (agglomerative) clustering of the timeseries.
See the Notes section for more details.
The keyword gets passed on to scipy.hierarchy.linkage. See its documentation to learn more about the different
keywords (References [1]).
See wikipedia for an introduction to hierarchical clustering (References [2]).
kwargs
Returns
-------
data : dios.DictOfSeries
A dictionary of pandas.Series, holding all the data.
flagger : saqc.flagger
The flagger object, holding flags and additional Informations related to `data`.
Flags values may have changed relatively to the input flagger.
References
----------
Documentation of the underlying hierarchical clustering algorithm:
[1] https://docs.scipy.org/doc/scipy/reference/generated/scipy.cluster.hierarchy.linkage.html
Introduction to Hierarchical clustering:
[2] https://en.wikipedia.org/wiki/Hierarchical_clustering
"""
fields
=
fields_scale1
+
fields_scale2
data_to_flag
=
data
[
fields
].
to_df
()
...
...
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