Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MLAir
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esde
machine-learning
MLAir
Commits
080c8029
Commit
080c8029
authored
4 years ago
by
lukas leufen
Browse files
Options
Downloads
Patches
Plain Diff
transformation is included in the preprocessing stage
parent
cdf911a5
No related branches found
No related tags found
4 merge requests
!136
update release branch
,
!135
Release v0.11.0
,
!134
MLAir is decoupled from join
,
!119
Resolve "Include advanced data handling in workflow"
Pipeline
#41375
failed
4 years ago
Stage: test
Stage: docs
Stage: pages
Stage: deploy
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/configuration/defaults.py
+2
-1
2 additions, 1 deletion
src/configuration/defaults.py
src/data_handling/advanced_data_handling.py
+33
-0
33 additions, 0 deletions
src/data_handling/advanced_data_handling.py
src/run_modules/pre_processing.py
+13
-0
13 additions, 0 deletions
src/run_modules/pre_processing.py
with
48 additions
and
1 deletion
src/configuration/defaults.py
+
2
−
1
View file @
080c8029
...
@@ -13,7 +13,8 @@ DEFAULT_START = "1997-01-01"
...
@@ -13,7 +13,8 @@ DEFAULT_START = "1997-01-01"
DEFAULT_END
=
"
2017-12-31
"
DEFAULT_END
=
"
2017-12-31
"
DEFAULT_WINDOW_HISTORY_SIZE
=
13
DEFAULT_WINDOW_HISTORY_SIZE
=
13
DEFAULT_OVERWRITE_LOCAL_DATA
=
False
DEFAULT_OVERWRITE_LOCAL_DATA
=
False
DEFAULT_TRANSFORMATION
=
{
"
scope
"
:
"
data
"
,
"
method
"
:
"
standardise
"
,
"
mean
"
:
"
estimate
"
}
# DEFAULT_TRANSFORMATION = {"scope": "data", "method": "standardise", "mean": "estimate"}
DEFAULT_TRANSFORMATION
=
{
"
scope
"
:
"
data
"
,
"
method
"
:
"
standardise
"
}
DEFAULT_HPC_LOGIN_LIST
=
[
"
ju
"
,
"
hdfmll
"
]
# ju[wels} #hdfmll(ogin)
DEFAULT_HPC_LOGIN_LIST
=
[
"
ju
"
,
"
hdfmll
"
]
# ju[wels} #hdfmll(ogin)
DEFAULT_HPC_HOST_LIST
=
[
"
jw
"
,
"
hdfmlc
"
]
# first part of node names for Juwels (jw[comp], hdfmlc(ompute).
DEFAULT_HPC_HOST_LIST
=
[
"
jw
"
,
"
hdfmlc
"
]
# first part of node names for Juwels (jw[comp], hdfmlc(ompute).
DEFAULT_CREATE_NEW_MODEL
=
True
DEFAULT_CREATE_NEW_MODEL
=
True
...
...
This diff is collapsed.
Click to expand it.
src/data_handling/advanced_data_handling.py
+
33
−
0
View file @
080c8029
...
@@ -17,6 +17,7 @@ from typing import Union, List, Tuple
...
@@ -17,6 +17,7 @@ from typing import Union, List, Tuple
import
logging
import
logging
from
functools
import
reduce
from
functools
import
reduce
from
src.data_handling.data_preparation
import
StationPrep
from
src.data_handling.data_preparation
import
StationPrep
from
src.helpers.join
import
EmptyQueryResult
number
=
Union
[
float
,
int
]
number
=
Union
[
float
,
int
]
...
@@ -68,6 +69,10 @@ class AbstractDataPreparation:
...
@@ -68,6 +69,10 @@ class AbstractDataPreparation:
def
own_args
(
cls
,
*
args
):
def
own_args
(
cls
,
*
args
):
return
remove_items
(
inspect
.
getfullargspec
(
cls
).
args
,
[
"
self
"
]
+
list
(
args
))
return
remove_items
(
inspect
.
getfullargspec
(
cls
).
args
,
[
"
self
"
]
+
list
(
args
))
@classmethod
def
transformation
(
cls
,
*
args
,
**
kwargs
):
raise
NotImplementedError
def
get_X
(
self
,
upsampling
=
False
,
as_numpy
=
False
):
def
get_X
(
self
,
upsampling
=
False
,
as_numpy
=
False
):
raise
NotImplementedError
raise
NotImplementedError
...
@@ -254,6 +259,34 @@ class DefaultDataPreparation(AbstractDataPreparation):
...
@@ -254,6 +259,34 @@ class DefaultDataPreparation(AbstractDataPreparation):
for
d
in
data
:
for
d
in
data
:
d
.
coords
[
dim
].
values
+=
np
.
timedelta64
(
*
timedelta
)
d
.
coords
[
dim
].
values
+=
np
.
timedelta64
(
*
timedelta
)
@classmethod
def
transformation
(
cls
,
set_stations
,
**
kwargs
):
sp_keys
=
{
k
:
kwargs
[
k
]
for
k
in
cls
.
_requirements
if
k
in
kwargs
}
transformation_dict
=
sp_keys
.
pop
(
"
transformation
"
)
if
transformation_dict
is
None
:
return
scope
=
transformation_dict
.
pop
(
"
scope
"
)
method
=
transformation_dict
.
pop
(
"
method
"
)
if
transformation_dict
.
pop
(
"
mean
"
,
None
)
is
not
None
:
return
mean
,
std
=
None
,
None
for
station
in
set_stations
:
try
:
sp
=
StationPrep
(
station
,
transformation
=
{
"
method
"
:
method
},
**
sp_keys
)
mean
=
sp
.
mean
.
copy
(
deep
=
True
)
if
mean
is
None
else
mean
.
combine_first
(
sp
.
mean
)
std
=
sp
.
std
.
copy
(
deep
=
True
)
if
std
is
None
else
std
.
combine_first
(
sp
.
std
)
except
(
AttributeError
,
EmptyQueryResult
):
continue
if
mean
is
None
:
return
None
mean_estimated
=
mean
.
mean
(
"
Stations
"
)
std_estimated
=
std
.
mean
(
"
Stations
"
)
return
{
"
scope
"
:
scope
,
"
method
"
:
method
,
"
mean
"
:
mean_estimated
,
"
std
"
:
std_estimated
}
def
run_data_prep
():
def
run_data_prep
():
...
...
This diff is collapsed.
Click to expand it.
src/run_modules/pre_processing.py
+
13
−
0
View file @
080c8029
...
@@ -257,6 +257,10 @@ class PreProcessing(RunEnvironment):
...
@@ -257,6 +257,10 @@ class PreProcessing(RunEnvironment):
"""
"""
t_outer
=
TimeTracking
()
t_outer
=
TimeTracking
()
logging
.
info
(
f
"
check valid stations started
{
'
(%s)
'
%
set_name
if
set_name
is
not
None
else
'
all
'
}
"
)
logging
.
info
(
f
"
check valid stations started
{
'
(%s)
'
%
set_name
if
set_name
is
not
None
else
'
all
'
}
"
)
# calculate transformation using train data
if
set_name
==
"
train
"
:
self
.
transformation
(
data_preparation
,
set_stations
)
# start station check
collection
=
DataCollection
()
collection
=
DataCollection
()
valid_stations
=
[]
valid_stations
=
[]
kwargs
=
self
.
data_store
.
create_args_dict
(
data_preparation
.
requirements
(),
scope
=
set_name
)
kwargs
=
self
.
data_store
.
create_args_dict
(
data_preparation
.
requirements
(),
scope
=
set_name
)
...
@@ -271,3 +275,12 @@ class PreProcessing(RunEnvironment):
...
@@ -271,3 +275,12 @@ class PreProcessing(RunEnvironment):
f
"
{
len
(
set_stations
)
}
valid stations.
"
)
f
"
{
len
(
set_stations
)
}
valid stations.
"
)
return
collection
,
valid_stations
return
collection
,
valid_stations
def
transformation
(
self
,
data_preparation
,
stations
):
if
hasattr
(
data_preparation
,
"
transformation
"
):
kwargs
=
self
.
data_store
.
create_args_dict
(
data_preparation
.
requirements
(),
scope
=
"
train
"
)
transformation_dict
=
data_preparation
.
transformation
(
stations
,
**
kwargs
)
if
transformation_dict
is
not
None
:
self
.
data_store
.
set
(
"
transformation
"
,
transformation_dict
)
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