1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-03 11:00:57 +08:00

Update repr for Experiment & Recorder

This commit is contained in:
D-X-Y
2021-03-04 05:02:56 +00:00
parent 229a39d0d3
commit 592db903b3
5 changed files with 13 additions and 7 deletions

View File

@@ -38,8 +38,10 @@ class QlibRecorder:
recorder_name : str
name of the recorder under the experiment one wants to start.
uri : str
the tracking uri of the experiment, where all the artifacts/metrics etc. will be stored.
The default uri are set in the qlib.config.
The tracking uri of the experiment, where all the artifacts/metrics etc. will be stored.
The default uri are set in the qlib.config. Note that this uri argument will not change the one defined in the config file.
Therefore, the next time when user call this function in the same experiment,
they have to also specify this argument with the same value. Otherwise, inconsistent uri may occur.
"""
run = self.start_exp(experiment_name, recorder_name, uri)
try:

View File

@@ -11,7 +11,7 @@ from ..log import get_module_logger
logger = get_module_logger("workflow", "INFO")
class Experiment:
class Experiment(object):
"""
This is the `Experiment` class for each experiment being run. The API is designed similar to mlflow.
(The link: https://mlflow.org/docs/latest/python_api/mlflow.html)
@@ -23,7 +23,7 @@ class Experiment:
self.active_recorder = None # only one recorder can running each time
def __repr__(self):
return str(self.info)
return "{name}(info={info})".format(name=self.__class__.__name__, info=self.info)
def __str__(self):
return str(self.info)

View File

@@ -14,7 +14,7 @@ from ..log import get_module_logger
logger = get_module_logger("workflow", "INFO")
class ExpManager:
class ExpManager(object):
"""
This is the `ExpManager` class for managing experiments. The API is designed similar to mlflow.
(The link: https://mlflow.org/docs/latest/python_api/mlflow.html)

View File

@@ -11,7 +11,7 @@ from ..log import get_module_logger
logger = get_module_logger("workflow", "INFO")
class Recorder:
class Recorder(object):
"""
This is the `Recorder` class for logging the experiments. The API is designed similar to mlflow.
(The link: https://mlflow.org/docs/latest/python_api/mlflow.html)
@@ -34,7 +34,7 @@ class Recorder:
self.status = Recorder.STATUS_S
def __repr__(self):
return str(self.info)
return "{name}(info={info})".format(name=self.__class__.__name__, info=self.info)
def __str__(self):
return str(self.info)

View File

@@ -110,7 +110,10 @@ def train():
# model initiaiton
model = init_instance_by_config(task["model"])
print(model)
dataset = init_instance_by_config(task["dataset"])
print(dataset)
print(R)
# start exp
with R.start(experiment_name="workflow"):
@@ -119,6 +122,7 @@ def train():
# prediction
recorder = R.get_recorder()
print(recorder)
rid = recorder.id
sr = SignalRecord(model, dataset, recorder)
sr.generate()