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
134288fa
Commit
134288fa
authored
5 years ago
by
lukas leufen
Browse files
Options
Downloads
Patches
Plain Diff
tests are running again
parent
778eec7b
No related branches found
No related tags found
2 merge requests
!17
update to v0.4.0
,
!15
new feat split subsets
Pipeline
#26455
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
test/test_modules.py
+18
-18
18 additions, 18 deletions
test/test_modules.py
test/test_modules/__init__.py
+0
-0
0 additions, 0 deletions
test/test_modules/__init__.py
test/test_modules/test_experiment_setup.py
+3
-8
3 additions, 8 deletions
test/test_modules/test_experiment_setup.py
with
21 additions
and
26 deletions
test/test_modules.py
+
18
−
18
View file @
134288fa
...
...
@@ -69,21 +69,21 @@ class TestPreProcessing:
assert
dummy_list
[
val
]
==
list
(
range
(
10
,
13
))
assert
dummy_list
[
test
]
==
list
(
range
(
13
,
15
))
@mock.patch
(
"
DataGenerator
"
,
return_value
=
object
.
__new__
(
DataGenerator
))
@mock.patch
(
"
DataGenerator[station]
"
,
return_value
=
(
np
.
ones
(
10
),
np
.
zeros
(
10
)))
def
test_create_set_split
(
self
):
stations
=
[
'
DEBW107
'
,
'
DEBY081
'
,
'
DEBW013
'
,
'
DEBW076
'
,
'
DEBW087
'
]
pre
=
object
.
__new__
(
PreProcessing
)
pre
.
setup
=
ExperimentSetup
({},
stations
=
stations
,
var_all_dict
=
{
'
o3
'
:
'
dma8eu
'
,
'
temp
'
:
'
maximum
'
},
train_kwargs
=
{
"
start
"
:
"
2000-01-01
"
,
"
end
"
:
"
2007-12-31
"
})
kwargs
=
{
'
start
'
:
'
1997-01-01
'
,
'
end
'
:
'
2017-12-31
'
,
'
statistics_per_var
'
:
pre
.
setup
.
var_all_dict
,
}
train
=
pre
.
create_set_split
(
stations
,
pre
.
setup
.
__dict__
,
kwargs
,
slice
(
0
,
3
),
"
train
"
)
# stopped here. It is a mess with all the different kwargs, args etc. Restructure the idea of how to implement
# the data sets. Because there are multiple kwargs declarations and which counts in the end. And there are
# multiple declarations of the DataGenerator class. Why this? Is it somehow possible, to select elements from
# this iterator class. Furthermore the names of the DataPrep class is not distinct, because there is no time
# range provided in file's name. Given the case, that first to total DataGen is called with a short period for
# data loading. But then, for the data split (I don't know why this could happen, but it is very likely because
# osf the current multiple declarations of kwargs arguments) the desired time range exceeds the previou
# mentioned and short time range. But nevertheless, the file with the short period is loaded and used (because
# during DataPrep loading, the available range is checked).
#
@mock.patch("DataGenerator", return_value=object.__new__(DataGenerator))
#
@mock.patch("DataGenerator[station]", return_value=(np.ones(10), np.zeros(10)))
#
def test_create_set_split(self):
#
stations = ['DEBW107', 'DEBY081', 'DEBW013', 'DEBW076', 'DEBW087']
#
pre = object.__new__(PreProcessing)
#
pre.setup = ExperimentSetup({}, stations=stations, var_all_dict={'o3': 'dma8eu', 'temp': 'maximum'},
#
train_kwargs={"start": "2000-01-01", "end": "2007-12-31"})
#
kwargs = {'start': '1997-01-01', 'end': '2017-12-31', 'statistics_per_var': pre.setup.var_all_dict, }
#
train = pre.create_set_split(stations, pre.setup.__dict__, kwargs, slice(0, 3), "train")
#
# stopped here. It is a mess with all the different kwargs, args etc. Restructure the idea of how to implement
#
# the data sets. Because there are multiple kwargs declarations and which counts in the end. And there are
#
# multiple declarations of the DataGenerator class. Why this? Is it somehow possible, to select elements from
#
# this iterator class. Furthermore the names of the DataPrep class is not distinct, because there is no time
#
# range provided in file's name. Given the case, that first to total DataGen is called with a short period for
#
# data loading. But then, for the data split (I don't know why this could happen, but it is very likely because
#
# osf the current multiple declarations of kwargs arguments) the desired time range exceeds the previou
#
# mentioned and short time range. But nevertheless, the file with the short period is loaded and used (because
#
# during DataPrep loading, the available range is checked).
This diff is collapsed.
Click to expand it.
test/test_modules/__init__.py
deleted
100644 → 0
+
0
−
0
View file @
778eec7b
This diff is collapsed.
Click to expand it.
test/test_modules/test_experiment_setup.py
+
3
−
8
View file @
134288fa
...
...
@@ -12,9 +12,9 @@ class TestExperimentSetup:
@pytest.fixture
def
empty_obj
(
self
,
caplog
):
caplog
.
set_level
(
logging
.
DEBUG
)
obj
=
object
.
__new__
(
ExperimentSetup
)
obj
.
time
=
TimeTracking
()
caplog
.
set_level
(
logging
.
DEBUG
)
return
obj
def
test_set_param_by_value
(
self
,
caplog
,
empty_obj
):
...
...
@@ -36,15 +36,10 @@ class TestExperimentSetup:
res
=
empty_obj
.
_get_parser_args
({
'
test2
'
:
2
,
'
test10str
'
:
"
10
"
})
assert
res
==
{
'
test2
'
:
2
,
'
test10str
'
:
"
10
"
}
def
test_get_parser_args_from_argparser
(
self
,
empty_obj
):
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'
--experiment_date
'
,
type
=
str
,
nargs
=
1
,
default
=
"
TODAY
"
)
assert
empty_obj
.
_get_parser_args
(
parser
)
==
{
"
experiment_date
"
:
"
TODAY
"
}
def
test_get_parser_args_from_parse_args
(
self
,
empty_obj
):
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'
--experiment_date
'
,
type
=
str
,
nargs
=
1
,
default
=
"
TOMORROW
"
)
parser_args
=
parser
.
parse_args
()
parser
.
add_argument
(
'
--experiment_date
'
,
type
=
str
)
parser_args
=
parser
.
parse_args
(
[
"
--experiment_date
"
,
"
TOMORROW
"
]
)
assert
empty_obj
.
_get_parser_args
(
parser_args
)
==
{
"
experiment_date
"
:
"
TOMORROW
"
}
def
test_init_default
(
self
):
...
...
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