1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-15 00:36:55 +08:00

format code

This commit is contained in:
lzh222333
2021-05-14 06:58:02 +00:00
parent ebd01e0de5
commit aef3f186c1
9 changed files with 15 additions and 13 deletions

View File

@@ -113,7 +113,7 @@ class OnlineSimulationExample:
self.rolling_gen = RollingGen( self.rolling_gen = RollingGen(
step=rolling_step, rtype=RollingGen.ROLL_SD, ds_extra_mod_func=None step=rolling_step, rtype=RollingGen.ROLL_SD, ds_extra_mod_func=None
) # The rolling tasks generator, ds_extra_mod_func is None because we just need to simulate to 2018-10-31 and needn't change the handler end time. ) # The rolling tasks generator, ds_extra_mod_func is None because we just need to simulate to 2018-10-31 and needn't change the handler end time.
self.trainer = DelayTrainerRM(self.exp_name, self.task_pool) # Also can be TrainerR, TrainerRM, DelayTrainerR self.trainer = DelayTrainerRM(self.exp_name, self.task_pool) # Also can be TrainerR, TrainerRM, DelayTrainerR
self.rolling_online_manager = OnlineManager( self.rolling_online_manager = OnlineManager(
RollingStrategy(exp_name, task_template=tasks, rolling_gen=self.rolling_gen), RollingStrategy(exp_name, task_template=tasks, rolling_gen=self.rolling_gen),
trainer=self.trainer, trainer=self.trainer,

View File

@@ -103,6 +103,7 @@ class AverageEnsemble(Ensemble):
Returns: Returns:
pd.DataFrame: the complete result of averaging and standardizing. pd.DataFrame: the complete result of averaging and standardizing.
""" """
def __call__(self, ensemble_dict: dict) -> pd.DataFrame: def __call__(self, ensemble_dict: dict) -> pd.DataFrame:
# need to flatten the nested dict # need to flatten the nested dict
ensemble_dict = flatten_dict(ensemble_dict, sep=FLATTEN_TUPLE) ensemble_dict = flatten_dict(ensemble_dict, sep=FLATTEN_TUPLE)

View File

@@ -64,7 +64,7 @@ class Group:
else: else:
raise NotImplementedError(f"Please specify valid `_ens_func`.") raise NotImplementedError(f"Please specify valid `_ens_func`.")
def __call__(self, ungrouped_dict: dict, n_jobs:int=1, verbose:int=0, *args, **kwargs) -> dict: def __call__(self, ungrouped_dict: dict, n_jobs: int = 1, verbose: int = 0, *args, **kwargs) -> dict:
""" """
Group the ungrouped_dict into different groups. Group the ungrouped_dict into different groups.

View File

@@ -8,7 +8,6 @@ import dill
from typing import Union from typing import Union
class Serializable: class Serializable:
""" """
Serializable will change the behaviors of pickle. Serializable will change the behaviors of pickle.

View File

@@ -41,8 +41,8 @@ class OnlineManager(Serializable):
It also provides a history recording of which models are online at what time. It also provides a history recording of which models are online at what time.
""" """
STATUS_SIMULATING = "simulating" # when calling `simulate` STATUS_SIMULATING = "simulating" # when calling `simulate`
STATUS_NORMAL = "normal" # the normal status STATUS_NORMAL = "normal" # the normal status
def __init__( def __init__(
self, self,
@@ -210,7 +210,9 @@ class OnlineManager(Serializable):
SIM_LOG_LEVEL = logging.INFO + 1 SIM_LOG_LEVEL = logging.INFO + 1
SIM_LOG_NAME = "SIMULATE_INFO" SIM_LOG_NAME = "SIMULATE_INFO"
def simulate(self, end_time, frequency="day", task_kwargs={}, model_kwargs={}, signal_kwargs={}) -> Union[pd.Series, pd.DataFrame]: def simulate(
self, end_time, frequency="day", task_kwargs={}, model_kwargs={}, signal_kwargs={}
) -> Union[pd.Series, pd.DataFrame]:
""" """
Starting from the current time, this method will simulate every routine in OnlineManager until the end time. Starting from the current time, this method will simulate every routine in OnlineManager until the end time.