mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-29 00:17:44 +00:00
a2f461cc81
* Update proposal.py Completed The HypothesisFeedback Class. * refine the core code --------- Co-authored-by: xuyang1 <xuyang1@microsoft.com>
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
"""
|
|
TODO: Model Structure RD-Loop
|
|
TODO: move the following code to a new class: Model_RD_Agent
|
|
"""
|
|
|
|
# import_from
|
|
|
|
from rdagent.app.qlib_rd_loop.conf import PROP_SETTING
|
|
from rdagent.core.proposal import (
|
|
Hypothesis2Experiment,
|
|
HypothesisExperiment2Feedback,
|
|
Trace,
|
|
)
|
|
from rdagent.core.task_generator import TaskGenerator
|
|
from rdagent.core.utils import import_class
|
|
|
|
scen = import_class(PROP_SETTING.qlib_model_scen)()
|
|
|
|
hypothesis_gen = import_class(PROP_SETTING.qlib_model_hypothesis_gen)(scen)
|
|
|
|
hypothesis2experiment: Hypothesis2Experiment = import_class(PROP_SETTING.qlib_model_hypothesis2experiment)()
|
|
|
|
qlib_model_coder: TaskGenerator = import_class(PROP_SETTING.qlib_model_coder)(scen)
|
|
qlib_model_runner: TaskGenerator = import_class(PROP_SETTING.qlib_model_runner)(scen)
|
|
|
|
qlib_model_summarizer: HypothesisExperiment2Feedback = import_class(PROP_SETTING.qlib_model_hypothesis2experiment)(scen)
|
|
|
|
trace = Trace(scen=scen)
|
|
for _ in range(PROP_SETTING.evolving_n):
|
|
hypothesis = hypothesis_gen.gen(trace)
|
|
exp = hypothesis2experiment.convert(hypothesis, trace)
|
|
exp = qlib_model_coder.generate(exp)
|
|
exp = qlib_model_runner.generate(exp)
|
|
feedback = qlib_model_summarizer.generateFeedback(exp, hypothesis, trace)
|
|
|
|
trace.hist.append((hypothesis, exp, feedback))
|