diff --git a/qlib/config.py b/qlib/config.py index 63773fcef..11ccc52ec 100644 --- a/qlib/config.py +++ b/qlib/config.py @@ -75,7 +75,8 @@ class Config: def set_conf_from_C(self, config_c): self.update(**config_c.__dict__["_config"]) - def register_from_C(self, config, skip_register=True): + @staticmethod + def register_from_C(config, skip_register=True): from .utils import set_log_with_config # pylint: disable=C0415 if C.registered and skip_register: @@ -202,7 +203,7 @@ _default_config = { "task_url": "mongodb://localhost:27017/", "task_db_name": "default_task_db", }, - # Shift minute for highfreq minite data, used in backtest + # Shift minute for highfreq minute data, used in backtest # if min_data_shift == 0, use default market time [9:30, 11:29, 1:00, 2:59] # if min_data_shift != 0, use shifted market time [9:30, 11:29, 1:00, 2:59] - shift*minute "min_data_shift": 0, diff --git a/qlib/contrib/report/data/ana.py b/qlib/contrib/report/data/ana.py index ad9c21d7f..782a92d5a 100644 --- a/qlib/contrib/report/data/ana.py +++ b/qlib/contrib/report/data/ana.py @@ -139,8 +139,8 @@ class FeaACAna(FeaAnalyser): class FeaSkewTurt(NumFeaAnalyser): def calc_stat_values(self): - self._skew = datetime_groupby_apply(self._dataset, "skew", skip_group=True) - self._kurt = datetime_groupby_apply(self._dataset, pd.DataFrame.kurt, skip_group=True) + self._skew = datetime_groupby_apply(self._dataset, "skew") + self._kurt = datetime_groupby_apply(self._dataset, pd.DataFrame.kurt) def plot_single(self, col, ax): self._skew[col].plot(ax=ax, label="skew") diff --git a/qlib/utils/paral.py b/qlib/utils/paral.py index 439ca34b0..7b06d9f7f 100644 --- a/qlib/utils/paral.py +++ b/qlib/utils/paral.py @@ -24,7 +24,7 @@ class ParallelExt(Parallel): def datetime_groupby_apply( - df, apply_func: Union[Callable, Text], axis=0, level="datetime", resample_rule="M", n_jobs=-1, skip_group=False + df, apply_func: Union[Callable, Text], axis=0, level="datetime", resample_rule="M", n_jobs=-1 ): """datetime_groupby_apply This function will apply the `apply_func` on the datetime level index. @@ -116,7 +116,7 @@ class AsyncCaller: # The code are for implementing following workflow # - Construct complex data structure nested with delayed joblib tasks # - For example, {"job": [, {"1": }]} -# - executing all the tasks and replace all the with its return value +# - executing all the tasks and replace all the with its return value # This will make it easier to convert some existing code to a parallel one @@ -160,7 +160,7 @@ class DelayedDict(DelayedTask): It is designed for following feature: Converting following existing code to parallel - constructing a dict - - key can be get instantly + - key can be gotten instantly - computation of values tasks a lot of time. - AND ALL the values are calculated in a SINGLE function """ @@ -280,7 +280,7 @@ def complex_parallel(paral: Parallel, complex_iter): class call_in_subproc: """ - When we repeating run functions, it is hard to avoid memory leakage. + When we repeatedly run functions, it is hard to avoid memory leakage. So we run it in the subprocess to ensure it is OK. NOTE: Because local object can't be pickled. So we can't implement it via closure.