From fbd8c6d87e1424c08997103b8e8fbf264858c4ed Mon Sep 17 00:00:00 2001 From: WinstonLiyt <104308117+WinstonLiyt@users.noreply.github.com> Date: Tue, 6 Aug 2024 16:03:40 +0800 Subject: [PATCH] feat: Add description for scenario experiments. (#174) * Fixed some bugs introduced during refactoring. * Add description for scenario experiments. * Update factor_from_report_w_sc.py * fix some ci bugs. * add @property to get_experiment_setting * fix a ci error. --- rdagent/core/scenario.py | 5 +++ rdagent/log/ui/app.py | 6 ++-- .../qlib/experiment/factor_experiment.py | 9 +++++- .../factor_from_report_experiment.py | 31 ++++++++++++++----- .../qlib/experiment/model_experiment.py | 10 +++++- 5 files changed, 49 insertions(+), 12 deletions(-) diff --git a/rdagent/core/scenario.py b/rdagent/core/scenario.py index 4ce48621..3e808da8 100644 --- a/rdagent/core/scenario.py +++ b/rdagent/core/scenario.py @@ -35,3 +35,8 @@ def rich_style_description(self) -> str: @abstractmethod def get_scenario_all_desc(self) -> str: """Combine all the description together""" + + @property + @abstractmethod + def get_experiment_setting(self) -> str: + """Get experiment setting and return as rich text string""" \ No newline at end of file diff --git a/rdagent/log/ui/app.py b/rdagent/log/ui/app.py index e3646f28..83e2e472 100644 --- a/rdagent/log/ui/app.py +++ b/rdagent/log/ui/app.py @@ -531,13 +531,13 @@ def tasks_window(tasks: list[FactorTask | ModelTask]): st.header("Scenario Description๐Ÿ“–", divider="violet", anchor="_scenario") # TODO: other scenarios if state.log_type == "Qlib Model": - st.markdown(QlibModelScenario().rich_style_description) + st.markdown(QlibModelScenario().rich_style_description, unsafe_allow_html=True) elif state.log_type == "Data Mining": st.markdown(DMModelScenario().rich_style_description) elif state.log_type == "Qlib Factor": - st.markdown(QlibFactorScenario().rich_style_description) + st.markdown(QlibFactorScenario().rich_style_description, unsafe_allow_html=True) elif state.log_type == "Model from Paper": - st.markdown(GeneralModelScenario().rich_style_description) + st.markdown(GeneralModelScenario().rich_style_description, unsafe_allow_html=True) # Summary Window diff --git a/rdagent/scenarios/qlib/experiment/factor_experiment.py b/rdagent/scenarios/qlib/experiment/factor_experiment.py index fdbe28ca..4e06f37a 100644 --- a/rdagent/scenarios/qlib/experiment/factor_experiment.py +++ b/rdagent/scenarios/qlib/experiment/factor_experiment.py @@ -62,7 +62,6 @@ def rich_style_description(self) -> str: #### [Objective](#_summary) To demonstrate the dynamic evolution of financial factors through the Qlib platform, emphasizing how each iteration enhances the accuracy and reliability of the resulting financial factors. - """ def get_scenario_all_desc(self) -> str: @@ -77,3 +76,11 @@ def get_scenario_all_desc(self) -> str: The simulator user can use to test your factor: {self.simulator} """ + + @property + def get_experiment_setting(self) -> str: + return """ +| Dataset ๐Ÿ“Š | Model ๐Ÿค– | Factors ๐ŸŒŸ | Data Split ๐Ÿงฎ | +|---------|----------|---------------|-------------------------------------------------| +| CSI300 | LGBModel | Alpha158 Plus | Train: 2008-01-01 to 2014-12-31
Valid: 2015-01-01 to 2016-12-31
Test  : 2017-01-01 to 2020-08-01 | + """ diff --git a/rdagent/scenarios/qlib/experiment/factor_from_report_experiment.py b/rdagent/scenarios/qlib/experiment/factor_from_report_experiment.py index 3d5c1798..ab4e15d9 100644 --- a/rdagent/scenarios/qlib/experiment/factor_from_report_experiment.py +++ b/rdagent/scenarios/qlib/experiment/factor_from_report_experiment.py @@ -17,7 +17,8 @@ class QlibFactorFromReportScenario(QlibFactorScenario): @property def rich_style_description(self) -> str: return """ -### R&D Agent-Qlib: Automated Quantitative Trading & Factors Extraction from Financial Reports Demo +### R&D Agent-Qlib: Automated Quantitative Trading & Factor Extraction from Financial Reports Demo + #### [Overview](#_summary) @@ -35,10 +36,26 @@ def rich_style_description(self) -> str: #### [Objective](#_summary) -| Objective | Description | -|-------------------|---------------------------------------------------------------------------------------------------------| -| **Convenience** | Provide a tool for financial and quantitative practitioners or enthusiasts to quickly extract and test factors from research reports. | -| **Efficiency** | Enable rapid identification of factors from a vast number of reports that could enhance the current factor library. | -| **Research Facilitation** | Support further research by continuously expanding and refining the factor library. | -| **Innovation** | Foster innovation in financial analysis by leveraging automated R&D processes to iterate and improve financial factors. | + + + + + + + + + + + + + +
๐Ÿ’ก Innovation Tool to quickly extract and test factors from research reports.
โšก Efficiency Rapid identification of valuable factors from numerous reports.
๐Ÿ—ƒ๏ธ Outputs Expand and refine the factor library to support further research.
+ """ + + @property + def get_experiment_setting(self) -> str: + return """ +| Dataset ๐Ÿ“Š | Model ๐Ÿค– | Factors ๐ŸŒŸ | Data Split ๐Ÿงฎ | +|---------|----------|---------------|-------------------------------------------------| +| CSI300 | LGBModel | Alpha158 Plus | Train: 2008-01-01 to 2014-12-31
Valid: 2015-01-01 to 2016-12-31
Test  : 2017-01-01 to 2020-08-01 | """ diff --git a/rdagent/scenarios/qlib/experiment/model_experiment.py b/rdagent/scenarios/qlib/experiment/model_experiment.py index ddb04761..c8e42cf1 100644 --- a/rdagent/scenarios/qlib/experiment/model_experiment.py +++ b/rdagent/scenarios/qlib/experiment/model_experiment.py @@ -60,7 +60,8 @@ def rich_style_description(self) -> str: #### [Objective](#_summary) -To demonstrate the dynamic evolution of models through the Qlib platform, emphasizing how each iteration enhances the accuracy and reliability of the resulting models. """ +To demonstrate the dynamic evolution of models through the Qlib platform, emphasizing how each iteration enhances the accuracy and reliability of the resulting models. + """ def get_scenario_all_desc(self) -> str: return f"""Background of the scenario: @@ -72,3 +73,10 @@ def get_scenario_all_desc(self) -> str: The simulator user can use to test your model: {self.simulator} """ + + def get_experiment_setting(self) -> str: + return """ +| Dataset ๐Ÿ“Š | Model ๐Ÿค– | Factors ๐ŸŒŸ | Data Split ๐Ÿงฎ | +|---------|----------|---------------|-------------------------------------------------| +| CSI300 | RDAgent-dev | 20 factors (Alpha158) | Train: 2008-01-01 to 2014-12-31
Valid: 2015-01-01 to 2016-12-31
Test  : 2017-01-01 to 2020-08-01 | + """