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
40ebb434
Commit
40ebb434
authored
2 years ago
by
leufen1
Browse files
Options
Downloads
Patches
Plain Diff
change data origin to reduce data loading
parent
69ffde01
Branches
Branches containing commit
Tags
Tags containing commit
5 merge requests
!480
Merge multiple stats into crps working branch
,
!470
Develop
,
!467
Resolve "release v2.2.0"
,
!466
Draft: Resolve "Include CRPS analysis and other ens verif methods or plots"
,
!460
Resolve "TECH: reduce CI running time"
Pipeline
#106888
failed
2 years ago
Stage: test
Stage: docs
Stage: pages
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/test_run_modules/test_pre_processing.py
+5
-3
5 additions, 3 deletions
test/test_run_modules/test_pre_processing.py
test/test_run_modules/test_training.py
+8
-36
8 additions, 36 deletions
test/test_run_modules/test_training.py
with
13 additions
and
39 deletions
test/test_run_modules/test_pre_processing.py
+
5
−
3
View file @
40ebb434
...
...
@@ -30,6 +30,7 @@ class TestPreProcessing:
def
obj_with_exp_setup
(
self
):
ExperimentSetup
(
stations
=
[
'
DEBW107
'
,
'
DEBY081
'
,
'
DEBW013
'
,
'
DEBW087
'
,
'
DEBW99X
'
],
statistics_per_var
=
{
'
o3
'
:
'
dma8eu
'
,
'
temp
'
:
'
maximum
'
},
station_type
=
"
background
"
,
data_origin
=
{
'
o3
'
:
'
UBA
'
,
'
temp
'
:
'
UBA
'
},
data_handler
=
DefaultDataHandler
)
pre
=
object
.
__new__
(
PreProcessing
)
super
(
PreProcessing
,
pre
).
__init__
()
...
...
@@ -38,7 +39,8 @@ class TestPreProcessing:
def
test_init
(
self
,
caplog
):
ExperimentSetup
(
stations
=
[
'
DEBW107
'
,
'
DEBY081
'
,
'
DEBW013
'
,
'
DEBW087
'
],
statistics_per_var
=
{
'
o3
'
:
'
dma8eu
'
,
'
temp
'
:
'
maximum
'
})
statistics_per_var
=
{
'
o3
'
:
'
dma8eu
'
,
'
temp
'
:
'
maximum
'
},
data_origin
=
{
'
o3
'
:
'
UBA
'
,
'
temp
'
:
'
UBA
'
})
caplog
.
clear
()
caplog
.
set_level
(
logging
.
INFO
)
with
PreProcessing
():
...
...
@@ -85,13 +87,13 @@ class TestPreProcessing:
def
test_create_set_split_all_stations
(
self
,
caplog
,
obj_with_exp_setup
):
caplog
.
set_level
(
logging
.
DEBUG
)
obj_with_exp_setup
.
create_set_split
(
slice
(
0
,
2
),
"
awesome
"
)
message
=
"
Awesome stations (len=5): [
'
DEBW107
'
,
'
DEBY081
'
,
'
DEBW013
'
,
'
DEBW07
6
'
,
'
DEBW99X
'
]
"
message
=
"
Awesome stations (len=5): [
'
DEBW107
'
,
'
DEBY081
'
,
'
DEBW013
'
,
'
DEBW0
8
7
'
,
'
DEBW99X
'
]
"
assert
(
'
root
'
,
10
,
message
)
in
caplog
.
record_tuples
data_store
=
obj_with_exp_setup
.
data_store
assert
isinstance
(
data_store
.
get
(
"
data_collection
"
,
"
general.awesome
"
),
DataCollection
)
with
pytest
.
raises
(
NameNotFoundInScope
):
data_store
.
get
(
"
data_collection
"
,
"
general
"
)
assert
data_store
.
get
(
"
stations
"
,
"
general.awesome
"
)
==
[
'
DEBW107
'
,
'
DEBY081
'
,
'
DEBW013
'
,
'
DEBW07
6
'
]
assert
data_store
.
get
(
"
stations
"
,
"
general.awesome
"
)
==
[
'
DEBW107
'
,
'
DEBY081
'
,
'
DEBW013
'
,
'
DEBW0
8
7
'
]
@pytest.mark.parametrize
(
"
name
"
,
(
None
,
"
tester
"
))
def
test_validate_station_serial
(
self
,
caplog
,
obj_with_exp_setup
,
name
):
...
...
This diff is collapsed.
Click to expand it.
test/test_run_modules/test_training.py
+
8
−
36
View file @
40ebb434
...
...
@@ -23,29 +23,6 @@ from mlair.run_modules.run_environment import RunEnvironment
from
mlair.run_modules.training
import
Training
def
my_test_model
(
activation
,
window_history_size
,
channels
,
output_size
,
dropout_rate
,
add_minor_branch
=
False
):
inception_model
=
InceptionModelBase
()
conv_settings_dict1
=
{
'
tower_1
'
:
{
'
reduction_filter
'
:
8
,
'
tower_filter
'
:
8
*
2
,
'
tower_kernel
'
:
(
3
,
1
),
'
activation
'
:
activation
},
'
tower_2
'
:
{
'
reduction_filter
'
:
8
,
'
tower_filter
'
:
8
*
2
,
'
tower_kernel
'
:
(
5
,
1
),
'
activation
'
:
activation
},
}
pool_settings_dict1
=
{
'
pool_kernel
'
:
(
3
,
1
),
'
tower_filter
'
:
8
*
2
,
'
activation
'
:
activation
}
X_input
=
keras
.
layers
.
Input
(
shape
=
(
window_history_size
+
1
,
1
,
channels
))
X_in
=
inception_model
.
inception_block
(
X_input
,
conv_settings_dict1
,
pool_settings_dict1
)
if
add_minor_branch
:
out
=
[
flatten_tail
(
X_in
,
inner_neurons
=
64
,
activation
=
activation
,
output_neurons
=
4
,
output_activation
=
'
linear
'
,
reduction_filter
=
64
,
name
=
'
Minor_1
'
,
dropout_rate
=
dropout_rate
,
)]
else
:
out
=
[]
X_in
=
keras
.
layers
.
Dropout
(
dropout_rate
)(
X_in
)
out
.
append
(
flatten_tail
(
X_in
,
inner_neurons
=
64
,
activation
=
activation
,
output_neurons
=
output_size
,
output_activation
=
'
linear
'
,
reduction_filter
=
64
,
name
=
'
Main
'
,
dropout_rate
=
dropout_rate
,
))
return
keras
.
Model
(
inputs
=
X_input
,
outputs
=
out
)
class
TestTraining
:
@pytest.fixture
...
...
@@ -90,15 +67,6 @@ class TestTraining:
RunEnvironment
().
__del__
()
except
AssertionError
:
pass
# try:
# yield obj
# finally:
# if os.path.exists(path):
# shutil.rmtree(path)
# try:
# RunEnvironment().__del__()
# except AssertionError:
# pass
@pytest.fixture
def
learning_rate
(
self
):
...
...
@@ -150,12 +118,16 @@ class TestTraining:
return
{
'
o3
'
:
'
dma8eu
'
,
'
temp
'
:
'
maximum
'
}
@pytest.fixture
def
data_collection
(
self
,
path
,
window_history_size
,
window_lead_time
,
statistics_per_var
):
data_prep
=
DefaultDataHandler
.
build
([
'
DEBW107
'
],
data_path
=
os
.
path
.
join
(
path
,
'
data
'
),
def
data_origin
(
self
):
return
{
'
o3
'
:
'
UBA
'
,
'
temp
'
:
'
UBA
'
}
@pytest.fixture
def
data_collection
(
self
,
path
,
window_history_size
,
window_lead_time
,
statistics_per_var
,
data_origin
):
data_prep
=
DefaultDataHandler
.
build
(
'
DEBW107
'
,
data_path
=
os
.
path
.
join
(
path
,
'
data
'
),
experiment_path
=
os
.
path
.
join
(
path
,
'
exp_path
'
),
statistics_per_var
=
statistics_per_var
,
station_type
=
"
background
"
,
network
=
"
AIRBASE
"
,
sampling
=
"
daily
"
,
target_dim
=
"
variables
"
,
target_var
=
"
o3
"
,
time_dim
=
"
datetime
"
,
sampling
=
"
daily
"
,
target_dim
=
"
variables
"
,
target_var
=
"
o3
"
,
time_dim
=
"
datetime
"
,
data_origin
=
data_origin
,
window_history_size
=
window_history_size
,
window_lead_time
=
window_lead_time
,
name_affix
=
"
train
"
)
return
DataCollection
([
data_prep
])
...
...
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