mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-29 00:17:44 +00:00
e0a24fb46f
* ignore result csv file * fix app scripts * rename taskgenerator to developer and generate to develop * fix a config bug in coder * fix a small bug in factor coder evaluators * remove a single logger in factor coder evaluators * fix a small bug in model coder main.py * rename Implementation to Workspace * move the prepare the inject_code into FBWorkspace to align all the behavior * fix a small bug in model feedback * remove debug lines for multi processing and simplify evaluators multi proc * add a copy function to workspace to freeze the workspace && add config prefix to speed up debugging * make hypothesisgen a abc class * use Qlib***Experiment * fix a small bug * rename Imp to Ws * rename sub_implementations to sub_workspace_list * fix a bug in feedback not presented as content in prompts * move proposal pys to proposal folder * reformat the folder * align factor and model qlib workspace and use template to handle the workspace * add a filter to evoagent to filter out false evo * align multi_proc_n into RDAGENT seeting * handle when runner gets empty experiment * fix logger merge remaining problems * fix black and isort automatically
49 lines
1.5 KiB
Python
49 lines
1.5 KiB
Python
"""
|
|
TODO: Factor Structure RD-Loop
|
|
"""
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
from rdagent.core.exception import FactorEmptyException
|
|
from rdagent.core.scenario import Scenario
|
|
from rdagent.log import rdagent_logger as logger
|
|
|
|
load_dotenv(override=True)
|
|
|
|
from rdagent.app.qlib_rd_loop.conf import PROP_SETTING
|
|
from rdagent.core.developer import Developer
|
|
from rdagent.core.proposal import (
|
|
Hypothesis2Experiment,
|
|
HypothesisExperiment2Feedback,
|
|
HypothesisGen,
|
|
Trace,
|
|
)
|
|
from rdagent.core.utils import import_class
|
|
|
|
scen: Scenario = import_class(PROP_SETTING.factor_scen)()
|
|
|
|
hypothesis_gen: HypothesisGen = import_class(PROP_SETTING.factor_hypothesis_gen)(scen)
|
|
|
|
hypothesis2experiment: Hypothesis2Experiment = import_class(PROP_SETTING.factor_hypothesis2experiment)()
|
|
|
|
qlib_factor_coder: Developer = import_class(PROP_SETTING.factor_coder)(scen)
|
|
|
|
qlib_factor_runner: Developer = import_class(PROP_SETTING.factor_runner)(scen)
|
|
|
|
qlib_factor_summarizer: HypothesisExperiment2Feedback = import_class(PROP_SETTING.factor_summarizer)(scen)
|
|
|
|
|
|
trace = Trace(scen=scen)
|
|
for _ in range(PROP_SETTING.evolving_n):
|
|
try:
|
|
hypothesis = hypothesis_gen.gen(trace)
|
|
exp = hypothesis2experiment.convert(hypothesis, trace)
|
|
exp = qlib_factor_coder.develop(exp)
|
|
exp = qlib_factor_runner.develop(exp)
|
|
feedback = qlib_factor_summarizer.generateFeedback(exp, hypothesis, trace)
|
|
|
|
trace.hist.append((hypothesis, exp, feedback))
|
|
except FactorEmptyException as e:
|
|
logger.warning(e)
|
|
continue
|