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
caf753bd
Commit
caf753bd
authored
4 years ago
by
leufen1
Browse files
Options
Downloads
Patches
Plain Diff
set experiment name now can handle strings and tuples of strings, /close
#263
parent
3109116b
Branches
Branches containing commit
Tags
Tags containing commit
3 merge requests
!253
include current develop
,
!252
Resolve "release v1.3.0"
,
!230
Resolve "experiment name with mixed sampling"
Pipeline
#58296
passed
4 years ago
Stage: test
Stage: docs
Stage: pages
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mlair/configuration/path_config.py
+5
-4
5 additions, 4 deletions
mlair/configuration/path_config.py
test/test_configuration/test_path_config.py
+8
-0
8 additions, 0 deletions
test/test_configuration/test_path_config.py
with
13 additions
and
4 deletions
mlair/configuration/path_config.py
+
5
−
4
View file @
caf753bd
...
@@ -4,13 +4,13 @@ import logging
...
@@ -4,13 +4,13 @@ import logging
import
os
import
os
import
re
import
re
import
socket
import
socket
from
typing
import
Tuple
from
typing
import
Union
# ROOT_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
# ROOT_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
ROOT_PATH
=
os
.
getcwd
()
ROOT_PATH
=
os
.
getcwd
()
def
prepare_host
(
create_new
=
True
,
data_path
=
None
,
sampling
=
"
daily
"
)
->
str
:
def
prepare_host
(
create_new
=
True
,
data_path
=
None
)
->
str
:
"""
"""
Set up host path.
Set up host path.
...
@@ -20,7 +20,6 @@ def prepare_host(create_new=True, data_path=None, sampling="daily") -> str:
...
@@ -20,7 +20,6 @@ def prepare_host(create_new=True, data_path=None, sampling="daily") -> str:
:param create_new: Create new path if enabled
:param create_new: Create new path if enabled
:param data_path: Parse your custom path (and therefore ignore preset paths fitting to known hosts)
:param data_path: Parse your custom path (and therefore ignore preset paths fitting to known hosts)
:param sampling: sampling rate to separate data physically by temporal resolution (deprecated)
:return: full path to data
:return: full path to data
"""
"""
...
@@ -73,7 +72,7 @@ def set_experiment_path(name: str, path: str = None) -> str:
...
@@ -73,7 +72,7 @@ def set_experiment_path(name: str, path: str = None) -> str:
return
experiment_path
return
experiment_path
def
set_experiment_name
(
name
:
str
=
None
,
sampling
:
str
=
None
)
->
str
:
def
set_experiment_name
(
name
:
str
=
None
,
sampling
:
Union
[
str
,
tuple
]
=
None
)
->
str
:
"""
"""
Set name of experiment and its path.
Set name of experiment and its path.
...
@@ -90,6 +89,8 @@ def set_experiment_name(name: str = None, sampling: str = None) -> str:
...
@@ -90,6 +89,8 @@ def set_experiment_name(name: str = None, sampling: str = None) -> str:
else
:
else
:
experiment_name
=
f
"
{
name
}
_network
"
experiment_name
=
f
"
{
name
}
_network
"
if
sampling
is
not
None
:
if
sampling
is
not
None
:
if
not
isinstance
(
sampling
,
str
):
sampling
=
sampling
[
-
1
]
experiment_name
+=
f
"
_
{
sampling
}
"
experiment_name
+=
f
"
_
{
sampling
}
"
return
experiment_name
return
experiment_name
...
...
This diff is collapsed.
Click to expand it.
test/test_configuration/test_path_config.py
+
8
−
0
View file @
caf753bd
...
@@ -68,6 +68,14 @@ class TestSetExperimentName:
...
@@ -68,6 +68,14 @@ class TestSetExperimentName:
exp_name
=
set_experiment_name
(
sampling
=
"
daily
"
)
exp_name
=
set_experiment_name
(
sampling
=
"
daily
"
)
assert
exp_name
==
"
TestExperiment_daily
"
assert
exp_name
==
"
TestExperiment_daily
"
def
test_set_experiment_name_tuple_sampling
(
self
):
exp_name
=
set_experiment_name
(
sampling
=
(
"
hourly
"
))
assert
exp_name
==
"
TestExperiment_hourly
"
exp_name
=
set_experiment_name
(
sampling
=
(
"
hourly
"
,
"
daily
"
))
assert
exp_name
==
"
TestExperiment_daily
"
exp_name
=
set_experiment_name
(
sampling
=
(
"
hourly
"
,
"
dummy
"
,
"
daily
"
))
assert
exp_name
==
"
TestExperiment_daily
"
def
test_set_experiment_path
(
self
):
def
test_set_experiment_path
(
self
):
exp_path
=
set_experiment_path
(
"
TestExperiment
"
)
exp_path
=
set_experiment_path
(
"
TestExperiment
"
)
assert
exp_path
==
os
.
path
.
abspath
(
os
.
path
.
join
(
ROOT_PATH
,
"
TestExperiment
"
))
assert
exp_path
==
os
.
path
.
abspath
(
os
.
path
.
join
(
ROOT_PATH
,
"
TestExperiment
"
))
...
...
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