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
1235b87c
Commit
1235b87c
authored
5 years ago
by
lukas leufen
Browse files
Options
Downloads
Patches
Plain Diff
experiment setup wasn't added to last commit
parent
d0b5ade5
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!59
Develop
,
!54
Lukas issue061 refac seperate input target vars
Pipeline
#30910
passed
5 years ago
Stage: test
Stage: pages
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/run_modules/experiment_setup.py
+17
-6
17 additions, 6 deletions
src/run_modules/experiment_setup.py
with
17 additions
and
6 deletions
src/run_modules/experiment_setup.py
+
17
−
6
View file @
1235b87c
...
...
@@ -27,7 +27,7 @@ class ExperimentSetup(RunEnvironment):
trainable: Train new model if true, otherwise try to load existing model
"""
def
__init__
(
self
,
parser_args
=
None
,
var_all_dict
=
None
,
stations
=
None
,
network
=
None
,
station_type
=
None
,
variables
=
None
,
def
__init__
(
self
,
parser_args
=
None
,
stations
=
None
,
network
=
None
,
station_type
=
None
,
variables
=
None
,
statistics_per_var
=
None
,
start
=
None
,
end
=
None
,
window_history_size
=
None
,
target_var
=
"
o3
"
,
target_dim
=
None
,
window_lead_time
=
None
,
dimensions
=
None
,
interpolate_dim
=
None
,
interpolate_method
=
None
,
limit_nan_fill
=
None
,
train_start
=
None
,
train_end
=
None
,
val_start
=
None
,
val_end
=
None
,
test_start
=
None
,
...
...
@@ -68,12 +68,11 @@ class ExperimentSetup(RunEnvironment):
helpers
.
check_path_and_create
(
self
.
data_store
.
get
(
"
forecast_path
"
,
"
general
"
))
# setup for data
self
.
_set_param
(
"
var_all_dict
"
,
var_all_dict
,
default
=
DEFAULT_VAR_ALL_DICT
)
self
.
_set_param
(
"
stations
"
,
stations
,
default
=
DEFAULT_STATIONS
)
self
.
_set_param
(
"
network
"
,
network
,
default
=
"
AIRBASE
"
)
self
.
_set_param
(
"
station_type
"
,
station_type
,
default
=
None
)
self
.
_set_param
(
"
variables
"
,
variables
,
default
=
list
(
self
.
data_store
.
get
(
"
var_all_dict
"
,
"
general
"
).
keys
())
)
self
.
_set_param
(
"
statistics_per_var
"
,
statistics_per_var
,
default
=
self
.
data_store
.
get
(
"
var_all_dict
"
,
"
general
"
))
self
.
_set_param
(
"
statistics_per_var
"
,
statistics_per_var
,
default
=
DEFAULT_VAR_ALL_DICT
)
self
.
_set_param
(
"
variables
"
,
variables
,
default
=
list
(
self
.
data_store
.
get
(
"
statistics_per_var
"
,
"
general
"
)
.
keys
())
)
self
.
_compare_variables_and_statistics
()
self
.
_set_param
(
"
start
"
,
start
,
default
=
"
1997-01-01
"
,
scope
=
"
general
"
)
self
.
_set_param
(
"
end
"
,
end
,
default
=
"
2017-12-31
"
,
scope
=
"
general
"
)
...
...
@@ -83,6 +82,7 @@ class ExperimentSetup(RunEnvironment):
# target
self
.
_set_param
(
"
target_var
"
,
target_var
,
default
=
"
o3
"
)
self
.
_check_target_var
()
self
.
_set_param
(
"
target_dim
"
,
target_dim
,
default
=
'
variables
'
)
self
.
_set_param
(
"
window_lead_time
"
,
window_lead_time
,
default
=
3
)
...
...
@@ -132,16 +132,27 @@ class ExperimentSetup(RunEnvironment):
return
{}
def
_compare_variables_and_statistics
(
self
):
logging
.
debug
(
"
check if all variables are included in statistics_per_var
"
)
var
=
self
.
data_store
.
get
(
"
variables
"
,
"
general
"
)
stat
=
self
.
data_store
.
get
(
"
statistics_per_var
"
,
"
general
"
)
var
=
self
.
data_store
.
get
(
"
variables
"
,
"
general
"
)
if
not
set
(
var
).
issubset
(
stat
.
keys
()):
missing
=
set
(
var
).
difference
(
stat
.
keys
())
raise
ValueError
(
f
"
Comparison of given variables and statistics_per_var show that not all requested
"
f
"
variables are part of statistics_per_var. Please add also information on the missing
"
f
"
statistics for the variables:
{
missing
}
"
)
def
_check_target_var
(
self
):
target_var
=
helpers
.
to_list
(
self
.
data_store
.
get
(
"
target_var
"
,
"
general
"
))
stat
=
self
.
data_store
.
get
(
"
statistics_per_var
"
,
"
general
"
)
var
=
self
.
data_store
.
get
(
"
variables
"
,
"
general
"
)
if
not
set
(
target_var
).
issubset
(
stat
.
keys
()):
raise
ValueError
(
f
"
Could not find target variable
{
target_var
}
in statistics_per_var.
"
)
unused_vars
=
set
(
stat
.
keys
()).
difference
(
set
(
var
).
union
(
target_var
))
if
len
(
unused_vars
)
>
0
:
logging
.
info
(
f
"
There are unused keys in statistics_per_var. Therefore remove keys:
{
unused_vars
}
"
)
stat_new
=
helpers
.
dict_pop
(
stat
,
list
(
unused_vars
))
self
.
_set_param
(
"
statistics_per_var
"
,
stat_new
)
if
__name__
==
"
__main__
"
:
...
...
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