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

Update exp base method

This commit is contained in:
Jactus
2021-03-17 13:37:17 +08:00
parent 34f0be2836
commit d78e42e2fe
2 changed files with 24 additions and 2 deletions

View File

@@ -181,6 +181,28 @@ class Experiment:
logger.info(f"No valid recorder found. Create a new recorder with name {recorder_name}.") logger.info(f"No valid recorder found. Create a new recorder with name {recorder_name}.")
return self.create_recorder(recorder_name), True return self.create_recorder(recorder_name), True
def _get_recorder(self, recorder_id=None, recorder_name=None):
"""
Get specific recorder by name or id. If it does not exist, raise ValueError
Parameters
----------
recorder_id :
The id of recorder
recorder_name :
The name of recorder
Returns
-------
Recorder:
The searched recorder
Raises
------
ValueError
"""
raise NotImplementedError(f"Please implement the `_get_recorder` method")
def list_recorders(self): def list_recorders(self):
""" """
List all the existing recorders of this experiment. Please first get the experiment instance before calling this method. List all the existing recorders of this experiment. Please first get the experiment instance before calling this method.

View File

@@ -181,14 +181,14 @@ class ExpManager:
def _get_exp(self, experiment_id=None, experiment_name=None) -> Experiment: def _get_exp(self, experiment_id=None, experiment_name=None) -> Experiment:
""" """
get specific experiment by name or id. If it does not exist, raise ValueError Get specific experiment by name or id. If it does not exist, raise ValueError.
Parameters Parameters
---------- ----------
experiment_id : experiment_id :
The id of experiment The id of experiment
experiment_name : experiment_name :
The id name experiment The name of experiment
Returns Returns
------- -------