Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SaQC
Manage
Activity
Members
Labels
Plan
Issues
36
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
ef9236af
Commit
ef9236af
authored
4 years ago
by
Peter Lünenschloß
Browse files
Options
Downloads
Patches
Plain Diff
added parameter passing syntax to trafo architecture
parent
11f79450
No related branches found
Branches containing commit
No related tags found
Tags containing commit
4 merge requests
!193
Release 1.4
,
!188
Release 1.4
,
!49
Dataprocessing features
,
!44
Dataprocessing features
Pipeline
#3602
failed with stage
Stage: test
in 11 minutes and 7 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
saqc/lib/tools.py
+11
-5
11 additions, 5 deletions
saqc/lib/tools.py
saqc/lib/ts_operators.py
+2
-2
2 additions, 2 deletions
saqc/lib/ts_operators.py
with
13 additions
and
7 deletions
saqc/lib/tools.py
+
11
−
5
View file @
ef9236af
...
...
@@ -11,6 +11,7 @@ import sklearn
from
functools
import
reduce
,
partial
import
pandas
as
pd
import
dios
import
inspect
# from saqc.flagger import BaseFlagger
from
saqc.lib.types
import
T
,
PandasLike
...
...
@@ -50,15 +51,18 @@ OP_MODULES = {'pd': pd,
}
def
evalFuncString
(
func_string
):
if
not
isinstance
(
func_string
,
str
):
return
func_string
def
evalFuncString
(
full_func_string
):
if
not
isinstance
(
full_func_string
,
str
):
return
full_func_string
full_func_string
=
full_func_string
.
split
(
"
$
"
)
func_string
=
full_func_string
[
0
]
paras
=
full_func_string
[
1
:]
module_dot
=
func_string
.
find
(
"
.
"
)
first
,
*
rest
=
func_string
.
split
(
"
.
"
)
if
rest
:
module
=
func_string
[:
module_dot
]
try
:
return
reduce
(
lambda
m
,
f
:
getattr
(
m
,
f
),
rest
,
OP_MODULES
[
first
])
func
=
reduce
(
lambda
m
,
f
:
getattr
(
m
,
f
),
rest
,
OP_MODULES
[
first
])
except
KeyError
:
availability_list
=
[
f
"'
{
k
}
'
(=
{
s
.
__name__
}
)
"
for
k
,
s
in
OP_MODULES
.
items
()]
availability_list
=
"
\n
"
.
join
(
availability_list
)
...
...
@@ -69,7 +73,7 @@ def evalFuncString(func_string):
else
:
if
func_string
in
SAQC_OPERATORS
:
return
SAQC_OPERATORS
[
func_string
]
func
=
SAQC_OPERATORS
[
func_string
]
else
:
availability_list
=
[
f
"'
{
k
}
'
(=
{
s
.
__name__
}
)
"
for
k
,
s
in
SAQC_OPERATORS
.
items
()]
availability_list
=
"
\n
"
.
join
(
availability_list
)
...
...
@@ -78,6 +82,8 @@ def evalFuncString(func_string):
f
"
dispatcher.
\n
Please select from:
\n
{
availability_list
}
"
)
para_names
=
inspect
.
getfullargspec
(
func
).
args
[
1
:
1
+
len
(
paras
)]
return
partial
(
func
,
**
dict
(
zip
(
para_names
,
paras
)))
def
composeFunction
(
functions
):
if
callable
(
functions
):
...
...
This diff is collapsed.
Click to expand it.
saqc/lib/ts_operators.py
+
2
−
2
View file @
ef9236af
...
...
@@ -75,7 +75,7 @@ def _kNN(in_arr, n_neighbors, algorithm="ball_tree"):
return
nbrs
.
kneighbors
()
def
kNNMaxGap
(
in_arr
,
n_neighbors
,
algorithm
=
'
ball_tree
'
):
def
kNNMaxGap
(
in_arr
,
n_neighbors
=
10
,
algorithm
=
'
ball_tree
'
):
in_arr
=
np
.
asarray
(
in_arr
)
dist
,
*
_
=
_kNN
(
in_arr
,
n_neighbors
,
algorithm
=
algorithm
)
sample_size
=
dist
.
shape
[
0
]
...
...
@@ -84,7 +84,7 @@ def kNNMaxGap(in_arr, n_neighbors, algorithm='ball_tree'):
return
dist
[
range
(
0
,
sample_size
),
max_gap_ind
]
def
kNNSum
(
in_arr
,
n_neighbors
,
algorithm
=
"
ball_tree
"
):
def
kNNSum
(
in_arr
,
n_neighbors
=
10
,
algorithm
=
"
ball_tree
"
):
in_arr
=
np
.
asarray
(
in_arr
)
dist
,
*
_
=
_kNN
(
in_arr
,
n_neighbors
,
algorithm
=
algorithm
)
return
dist
.
sum
(
axis
=
1
)
...
...
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