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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esde
machine-learning
MLAir
Commits
1cfd0353
Commit
1cfd0353
authored
5 years ago
by
lukas leufen
Browse files
Options
Downloads
Plain Diff
include experimentSetup class /close
#12
parents
7622fe10
a40504e9
Branches
Branches containing commit
No related tags found
3 merge requests
!12
Experiment Setup finished
,
!11
finish run script creation, /close #11
,
!10
finish class ExperimentSetup
Pipeline
#25971
passed
5 years ago
Stage: test
Stage: pages
Stage: deploy
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
run.py
+65
-14
65 additions, 14 deletions
run.py
src/helpers.py
+1
-1
1 addition, 1 deletion
src/helpers.py
with
67 additions
and
15 deletions
.gitignore
+
1
−
0
View file @
1cfd0353
...
@@ -56,3 +56,4 @@ htmlcov/
...
@@ -56,3 +56,4 @@ htmlcov/
.pytest_cache
.pytest_cache
/test/data/
/test/data/
report.html
report.html
/TestExperiment/
This diff is collapsed.
Click to expand it.
run.py
+
65
−
14
View file @
1cfd0353
...
@@ -38,25 +38,75 @@ class run(object):
...
@@ -38,25 +38,75 @@ class run(object):
class
ExperimentSetup
:
class
ExperimentSetup
:
"""
params:
trainable: Train new model if true, otherwise try to load existing model
"""
def
__init__
(
self
):
def
__init__
(
self
,
**
kwargs
):
self
.
data_path
=
None
self
.
data_path
=
None
self
.
experiment_path
=
None
self
.
experiment_path
=
None
self
.
experiment_name
=
None
self
.
experiment_name
=
None
self
.
trainable
=
False
self
.
trainable
=
None
self
.
setup_experiment
()
self
.
fraction_of_train
=
None
self
.
use_all_stations_on_all_data_sets
=
None
def
setup_experiment
(
self
):
self
.
network
=
None
self
.
var_all_dict
=
None
self
.
all_stations
=
None
self
.
variables
=
None
self
.
dimensions
=
None
self
.
dim
=
None
self
.
target_dim
=
None
self
.
target_var
=
None
self
.
setup_experiment
(
**
kwargs
)
def
_set_param
(
self
,
param
,
value
,
default
=
None
):
if
default
is
not
None
:
value
=
value
.
get
(
param
,
default
)
setattr
(
self
,
param
,
value
)
logging
.
info
(
f
"
set experiment attribute:
{
param
}
=
{
value
}
"
)
def
setup_experiment
(
self
,
**
kwargs
):
# set data path of this experiment
# set data path of this experiment
self
.
data_path
=
helpers
.
prepare_host
()
self
.
_set_param
(
"
data_path
"
,
helpers
.
prepare_host
()
)
# set experiment name
# set experiment name
experiment_date
=
parser
.
parse_args
([
"
experiment_date
"
])
exp_date
=
args
.
experiment_date
self
.
experiment_name
,
self
.
experiment_path
=
helpers
.
set_experiment_name
(
experiment_date
=
experiment_date
)
exp_name
,
exp_path
=
helpers
.
set_experiment_name
(
experiment_date
=
exp_date
)
self
.
_set_param
(
"
experiment_name
"
,
exp_name
)
# set if model shall be trained or not
self
.
_set_param
(
"
experiment_path
"
,
exp_path
)
self
.
trainable
=
True
helpers
.
check_path_and_create
(
self
.
experiment_path
)
# set if model is trainable
self
.
_set_param
(
"
trainable
"
,
kwargs
,
default
=
True
)
# set fraction of train
self
.
_set_param
(
"
fraction_of_train
"
,
kwargs
,
default
=
0.8
)
# use all stations on all data sets (train, val, test)
self
.
_set_param
(
"
use_all_stations_on_all_data_sets
"
,
kwargs
,
default
=
True
)
self
.
_set_param
(
"
network
"
,
kwargs
,
default
=
"
AIRBASE
"
)
self
.
_set_param
(
"
var_all_dict
"
,
kwargs
,
default
=
{
'
o3
'
:
'
dma8eu
'
,
'
relhum
'
:
'
average_values
'
,
'
temp
'
:
'
maximum
'
,
'
u
'
:
'
average_values
'
,
'
v
'
:
'
average_values
'
,
'
no
'
:
'
dma8eu
'
,
'
no2
'
:
'
dma8eu
'
,
'
cloudcover
'
:
'
average_values
'
,
'
pblheight
'
:
'
maximum
'
})
self
.
_set_param
(
"
all_stations
"
,
kwargs
,
default
=
[
'
DEBW107
'
,
'
DEBY081
'
,
'
DEBW013
'
,
'
DEBW076
'
,
'
DEBW087
'
,
'
DEBY052
'
,
'
DEBY032
'
,
'
DEBW022
'
,
'
DEBY004
'
,
'
DEBY020
'
,
'
DEBW030
'
,
'
DEBW037
'
,
'
DEBW031
'
,
'
DEBW015
'
,
'
DEBW073
'
,
'
DEBY039
'
,
'
DEBW038
'
,
'
DEBW081
'
,
'
DEBY075
'
,
'
DEBW040
'
,
'
DEBY053
'
,
'
DEBW059
'
,
'
DEBW027
'
,
'
DEBY072
'
,
'
DEBW042
'
,
'
DEBW039
'
,
'
DEBY001
'
,
'
DEBY113
'
,
'
DEBY089
'
,
'
DEBW024
'
,
'
DEBW004
'
,
'
DEBY037
'
,
'
DEBW056
'
,
'
DEBW029
'
,
'
DEBY068
'
,
'
DEBW010
'
,
'
DEBW026
'
,
'
DEBY002
'
,
'
DEBY079
'
,
'
DEBW084
'
,
'
DEBY049
'
,
'
DEBY031
'
,
'
DEBW019
'
,
'
DEBW001
'
,
'
DEBY063
'
,
'
DEBY005
'
,
'
DEBW046
'
,
'
DEBW103
'
,
'
DEBW052
'
,
'
DEBW034
'
,
'
DEBY088
'
,
])
self
.
_set_param
(
"
variables
"
,
kwargs
,
default
=
list
(
self
.
var_all_dict
.
keys
()))
self
.
_set_param
(
"
dimensions
"
,
kwargs
,
default
=
{
'
new_index
'
:
[
'
datetime
'
,
'
Stations
'
]})
self
.
_set_param
(
"
dim
"
,
kwargs
,
default
=
'
datetime
'
)
self
.
_set_param
(
"
target_dim
"
,
kwargs
,
default
=
'
variables
'
)
self
.
_set_param
(
"
target_var
"
,
kwargs
,
default
=
"
o3
"
)
class
PreProcessing
(
run
):
class
PreProcessing
(
run
):
...
@@ -83,11 +133,12 @@ class PostProcessing(run):
...
@@ -83,11 +133,12 @@ class PostProcessing(run):
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'
experiment date
'
,
metavar
=
'
exp_date
'
,
type
=
str
,
nargs
=
1
,
help
=
'
set experiment date as string
'
,
parser
.
add_argument
(
'
--experiment_date
'
,
metavar
=
'
--exp_date
'
,
type
=
str
,
nargs
=
1
,
default
=
None
,
default
=
None
)
help
=
"
set experiment date as string
"
)
args
=
parser
.
parse_args
()
with
run
():
with
run
():
exp_setup
=
ExperimentSetup
()
exp_setup
=
ExperimentSetup
(
trainable
=
True
)
PreProcessing
(
exp_setup
)
PreProcessing
(
exp_setup
)
...
...
This diff is collapsed.
Click to expand it.
src/helpers.py
+
1
−
1
View file @
1cfd0353
...
@@ -161,7 +161,7 @@ def prepare_host():
...
@@ -161,7 +161,7 @@ def prepare_host():
def
set_experiment_name
(
experiment_date
=
None
,
experiment_path
=
None
):
def
set_experiment_name
(
experiment_date
=
None
,
experiment_path
=
None
):
if
experiment_date
is
None
:
if
experiment_date
is
None
:
experiment_name
=
""
experiment_name
=
"
TestExperiment
"
else
:
else
:
experiment_name
=
f
"
{
experiment_date
}
_network/
"
experiment_name
=
f
"
{
experiment_date
}
_network/
"
if
experiment_path
is
None
:
if
experiment_path
is
None
:
...
...
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