mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-14 00:06:58 +08:00
Update repr for Experiment & Recorder
This commit is contained in:
@@ -38,8 +38,10 @@ class QlibRecorder:
|
|||||||
recorder_name : str
|
recorder_name : str
|
||||||
name of the recorder under the experiment one wants to start.
|
name of the recorder under the experiment one wants to start.
|
||||||
uri : str
|
uri : str
|
||||||
the tracking uri of the experiment, where all the artifacts/metrics etc. will be stored.
|
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 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)
|
run = self.start_exp(experiment_name, recorder_name, uri)
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from ..log import get_module_logger
|
|||||||
logger = get_module_logger("workflow", "INFO")
|
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.
|
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)
|
(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
|
self.active_recorder = None # only one recorder can running each time
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return str(self.info)
|
return "{name}(info={info})".format(name=self.__class__.__name__, info=self.info)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.info)
|
return str(self.info)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ from ..log import get_module_logger
|
|||||||
logger = get_module_logger("workflow", "INFO")
|
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.
|
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)
|
(The link: https://mlflow.org/docs/latest/python_api/mlflow.html)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from ..log import get_module_logger
|
|||||||
logger = get_module_logger("workflow", "INFO")
|
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.
|
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)
|
(The link: https://mlflow.org/docs/latest/python_api/mlflow.html)
|
||||||
@@ -34,7 +34,7 @@ class Recorder:
|
|||||||
self.status = Recorder.STATUS_S
|
self.status = Recorder.STATUS_S
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return str(self.info)
|
return "{name}(info={info})".format(name=self.__class__.__name__, info=self.info)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.info)
|
return str(self.info)
|
||||||
|
|||||||
@@ -110,7 +110,10 @@ def train():
|
|||||||
|
|
||||||
# model initiaiton
|
# model initiaiton
|
||||||
model = init_instance_by_config(task["model"])
|
model = init_instance_by_config(task["model"])
|
||||||
|
print(model)
|
||||||
dataset = init_instance_by_config(task["dataset"])
|
dataset = init_instance_by_config(task["dataset"])
|
||||||
|
print(dataset)
|
||||||
|
print(R)
|
||||||
|
|
||||||
# start exp
|
# start exp
|
||||||
with R.start(experiment_name="workflow"):
|
with R.start(experiment_name="workflow"):
|
||||||
@@ -119,6 +122,7 @@ def train():
|
|||||||
|
|
||||||
# prediction
|
# prediction
|
||||||
recorder = R.get_recorder()
|
recorder = R.get_recorder()
|
||||||
|
print(recorder)
|
||||||
rid = recorder.id
|
rid = recorder.id
|
||||||
sr = SignalRecord(model, dataset, recorder)
|
sr = SignalRecord(model, dataset, recorder)
|
||||||
sr.generate()
|
sr.generate()
|
||||||
|
|||||||
Reference in New Issue
Block a user