mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-11 23:06:58 +08:00
Some Optimization of online code (#784)
* Some Optimization of online code * more flexible updater and load_object & fix p*_uri * make recorder more friendly * remove unused import
This commit is contained in:
@@ -122,6 +122,8 @@ class AverageEnsemble(Ensemble):
|
||||
# need to flatten the nested dict
|
||||
ensemble_dict = flatten_dict(ensemble_dict, sep=FLATTEN_TUPLE)
|
||||
values = list(ensemble_dict.values())
|
||||
# NOTE: this may change the style underlying data!!!!
|
||||
# from pd.DataFrame to pd.Series
|
||||
results = pd.concat(values, axis=1)
|
||||
results = results.groupby("datetime").apply(lambda df: (df - df.mean()) / df.std())
|
||||
results = results.mean(axis=1)
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
"""
|
||||
Group can group a set of objects based on `group_func` and change them to a dict.
|
||||
After group, we provide a method to reduce them.
|
||||
After group, we provide a method to reduce them.
|
||||
|
||||
For example:
|
||||
For example:
|
||||
|
||||
group: {(A,B,C1): object, (A,B,C2): object} -> {(A,B): {C1: object, C2: object}}
|
||||
reduce: {(A,B): {C1: object, C2: object}} -> {(A,B): object}
|
||||
@@ -109,5 +109,5 @@ class RollingGroup(Group):
|
||||
grouped_dict.setdefault(key[:-1], {})[key[-1]] = values
|
||||
return grouped_dict
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(ens=RollingEnsemble())
|
||||
def __init__(self, ens=RollingEnsemble()):
|
||||
super().__init__(ens=ens)
|
||||
|
||||
@@ -26,6 +26,7 @@ from qlib.workflow.record_temp import SignalRecord
|
||||
from qlib.workflow.recorder import Recorder
|
||||
from qlib.workflow.task.manage import TaskManager, run_task
|
||||
|
||||
|
||||
# from qlib.data.dataset.weight import Reweighter
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user