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
e80be319
Commit
e80be319
authored
5 years ago
by
lukas leufen
Browse files
Options
Downloads
Patches
Plain Diff
more docs and bugfix in tests
parent
ab80fd42
No related branches found
No related tags found
2 merge requests
!9
new version v0.2.0
,
!8
data generator
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/data_generator.py
+4
-4
4 additions, 4 deletions
src/data_generator.py
test/test_data_generator.py
+2
-2
2 additions, 2 deletions
test/test_data_generator.py
with
6 additions
and
6 deletions
src/data_generator.py
+
4
−
4
View file @
e80be319
...
...
@@ -103,7 +103,7 @@ class DataGenerator(keras.utils.Sequence):
"""
Select data for given key, create a DataPrep object and interpolate, transform, make history and labels and
remove nans.
:param key:
:param key:
station key to choose the data generator.
:return: preprocessed data as a DataPrep instance
"""
station
=
self
.
get_station_key
(
key
)
...
...
@@ -115,11 +115,11 @@ class DataGenerator(keras.utils.Sequence):
data
.
history_label_nan_remove
(
self
.
interpolate_dim
)
return
data
def
get_station_key
(
self
,
key
:
Union
[
str
,
int
,
List
[
Union
[
str
,
int
]]])
->
str
:
def
get_station_key
(
self
,
key
:
Union
[
None
,
str
,
int
,
List
[
Union
[
None
,
str
,
int
]]])
->
str
:
"""
Return a valid station key or raise KeyError if this wasn
'
t possible
:param key:
:return:
:param key:
station key to choose the data generator.
:return:
station key (id from database)
"""
# extract value if given as list
if
isinstance
(
key
,
list
):
...
...
This diff is collapsed.
Click to expand it.
test/test_data_generator.py
+
2
−
2
View file @
e80be319
...
...
@@ -74,9 +74,9 @@ class TestDataGenerator:
def
test_get_key_representation
(
self
,
gen
):
gen
.
stations
.
append
(
"
DEBW108
"
)
f
=
gen
.
__iter__
.
get_station_key
f
=
gen
.
get_station_key
iter
(
gen
)
assert
f
(
None
)
==
"
DEBW107
"
assert
f
([
None
])
==
"
DEBW107
"
with
pytest
.
raises
(
KeyError
)
as
e
:
f
([
None
,
None
])
assert
"
More than one key was given: [None, None]
"
in
e
.
value
.
args
[
0
]
...
...
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