Update the detailed process and prompt of factor loop. (#96)

Update the detailed process and prompt of factor loop.
This commit is contained in:
WinstonLiyt
2024-07-22 18:18:08 +08:00
committed by GitHub
parent 761df330de
commit 7220d33668
6 changed files with 23 additions and 2 deletions
+4
View File
@@ -163,3 +163,7 @@ mlruns/
# possible output from coder or runner
*.pth
*qlib_res.csv
# shell script
*.out
*.sh
+1 -1
View File
@@ -1,5 +1,5 @@
"""
TODO: Factor Structure RD-Loop
Factor Structure RD-Loop
"""
from dotenv import load_dotenv
@@ -44,6 +44,7 @@ class FactorHypothesisGen(HypothesisGen):
targets="factors",
scenario=self.scen.get_scenario_all_desc(),
hypothesis_output_format=context_dict["hypothesis_output_format"],
hypothesis_specification=context_dict["hypothesis_specification"],
)
)
user_prompt = (
@@ -40,7 +40,7 @@ class ModelHypothesisGen(HypothesisGen):
targets="model",
scenario=self.scen.get_scenario_all_desc(),
hypothesis_output_format=context_dict["hypothesis_output_format"],
hypothesis_specification = context_dict["hypothesis_specification"],
hypothesis_specification=context_dict["hypothesis_specification"],
)
)
user_prompt = (
+15
View File
@@ -64,6 +64,21 @@ model_hypothesis_specification: |-
}
]
factor_hypothesis_specification: |-
Additional Specifications:
Hypotheses should grow and evolve based on the previous hypothesis. If there is no previous hypothesis, start with something simple. Gradually build up upon previous hypotheses and feedback.
Ensure that the hypothesis focuses on the creation and selection of factors in quantitative finance. Each hypothesis should address specific factor characteristics such as type (momentum, value, quality), calculation methods, or inclusion criteria. Avoid hypotheses related to model architecture or optimization processes.
Sample Hypotheses (Only learn from the format as these are not the knowledge):
- "Include a momentum factor based on the last 12 months' returns."
- "Add a value factor calculated as the book-to-market ratio."
- "Incorporate a quality factor derived from return on equity (ROE)."
- "Use a volatility factor based on the standard deviation of returns over the past 6 months."
- "Include a sentiment factor derived from news sentiment scores."
- "The momentum factor should be calculated using a 6-month look-back period."
- "Combine value and momentum factors using a weighted average approach."
- "Filter stocks by market capitalization before calculating the factors."
factor_experiment_output_format: |-
The output should follow JSON format. The schema is as follows:
{
@@ -33,6 +33,7 @@ class QlibFactorHypothesisGen(FactorHypothesisGen):
"hypothesis_and_feedback": hypothesis_feedback,
"RAG": ...,
"hypothesis_output_format": prompt_dict["hypothesis_output_format"],
"hypothesis_specification": prompt_dict["factor_hypothesis_specification"],
}
return context_dict, True