mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-08-08 20:47:44 +00:00
feat: add entry for rdagent. (#187)
* Add entries * update entry for rdagent * lint * fix typo
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
"""
|
||||
CLI entrance for all rdagent application.
|
||||
|
||||
This will
|
||||
- make rdagent a nice entry and
|
||||
- autoamtically load dotenv
|
||||
"""
|
||||
import fire
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from rdagent.app.data_mining.model import main as med_model
|
||||
from rdagent.app.general_model.general_model import (
|
||||
extract_models_and_implement as general_model,
|
||||
)
|
||||
from rdagent.app.qlib_rd_loop.factor import main as fin_factor
|
||||
from rdagent.app.qlib_rd_loop.factor_from_report import main as fin_factor_report
|
||||
from rdagent.app.qlib_rd_loop.model import main as fin_model
|
||||
|
||||
load_dotenv()
|
||||
|
||||
|
||||
def app():
|
||||
fire.Fire(
|
||||
{
|
||||
"fin_factor": fin_factor,
|
||||
"fin_factor_report": fin_factor_report,
|
||||
"fin_model": fin_model,
|
||||
"med_model": med_model,
|
||||
"general_model": general_model,
|
||||
}
|
||||
)
|
||||
@@ -11,6 +11,8 @@ class ModelRDLoop(RDLoop):
|
||||
|
||||
def main(path=None, step_n=None):
|
||||
"""
|
||||
Auto R&D Evolving loop for models in a medical scenario.
|
||||
|
||||
You can continue running session by
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# %%
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from rdagent.scenarios.general_model.scenario import GeneralModelScenario
|
||||
@@ -17,11 +16,11 @@ from rdagent.log import rdagent_logger as logger
|
||||
from rdagent.scenarios.qlib.developer.model_coder import QlibModelCoSTEER
|
||||
|
||||
|
||||
def extract_models_and_implement(
|
||||
report_file_path: str,
|
||||
) -> None:
|
||||
def extract_models_and_implement(report_file_path: str) -> None:
|
||||
"""
|
||||
Extracts models from a given PDF report file and implements the necessary operations.
|
||||
This is a research copilot to automatically implement models from a report file or paper.
|
||||
|
||||
It extracts models from a given PDF report file and implements the necessary operations.
|
||||
|
||||
Parameters:
|
||||
report_file_path (str): The path to the report file. The file must be a PDF file.
|
||||
|
||||
@@ -27,11 +27,13 @@ class FactorRDLoop(RDLoop):
|
||||
|
||||
def main(path=None, step_n=None):
|
||||
"""
|
||||
Auto R&D Evolving loop for fintech factors.
|
||||
|
||||
You can continue running session by
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
dotenv run -- python rdagent/app/qlib_rd_loop/factor_w_sc.py $LOG_PATH/__session__/1/0_propose --step_n 1 # `step_n` is a optional paramter
|
||||
dotenv run -- python rdagent/app/qlib_rd_loop/factor.py $LOG_PATH/__session__/1/0_propose --step_n 1 # `step_n` is a optional paramter
|
||||
|
||||
"""
|
||||
if path is None:
|
||||
+4
-2
@@ -6,7 +6,7 @@ import fire
|
||||
from jinja2 import Environment, StrictUndefined
|
||||
|
||||
from rdagent.app.qlib_rd_loop.conf import FACTOR_FROM_REPORT_PROP_SETTING
|
||||
from rdagent.app.qlib_rd_loop.factor_w_sc import FactorRDLoop
|
||||
from rdagent.app.qlib_rd_loop.factor import FactorRDLoop
|
||||
from rdagent.components.document_reader.document_reader import (
|
||||
extract_first_page_screenshot_from_pdf,
|
||||
load_and_process_pdfs_by_langchain,
|
||||
@@ -142,11 +142,13 @@ class FactorReportLoop(FactorRDLoop, metaclass=LoopMeta):
|
||||
|
||||
def main(path=None, step_n=None):
|
||||
"""
|
||||
Auto R&D Evolving loop for fintech factors (the factors are extracted from finance report).
|
||||
|
||||
You can continue running session by
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
dotenv run -- python rdagent/app/qlib_rd_loop/factor_from_report_w_sc.py $LOG_PATH/__session__/1/0_propose --step_n 1 # `step_n` is a optional parameter
|
||||
dotenv run -- python rdagent/app/qlib_rd_loop/factor_from_report.py $LOG_PATH/__session__/1/0_propose --step_n 1 # `step_n` is a optional parameter
|
||||
|
||||
"""
|
||||
if path is None:
|
||||
@@ -15,11 +15,13 @@ class ModelRDLoop(RDLoop):
|
||||
|
||||
def main(path=None, step_n=None):
|
||||
"""
|
||||
Auto R&D Evolving loop for fintech models
|
||||
|
||||
You can continue running session by
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
dotenv run -- python rdagent/app/qlib_rd_loop/model_w_sc.py $LOG_PATH/__session__/1/0_propose --step_n 1 # `step_n` is a optional paramter
|
||||
dotenv run -- python rdagent/app/qlib_rd_loop/model.py $LOG_PATH/__session__/1/0_propose --step_n 1 # `step_n` is a optional paramter
|
||||
|
||||
"""
|
||||
if path is None:
|
||||
@@ -12,6 +12,7 @@ from jinja2 import Environment, StrictUndefined
|
||||
from sklearn.cluster import KMeans
|
||||
from sklearn.metrics.pairwise import cosine_similarity
|
||||
from sklearn.preprocessing import normalize
|
||||
from tqdm.auto import tqdm
|
||||
|
||||
from rdagent.components.document_reader.document_reader import (
|
||||
load_and_process_pdfs_by_langchain,
|
||||
@@ -62,7 +63,7 @@ def classify_report_from_dict(
|
||||
res_dict = {}
|
||||
classify_prompt = document_process_prompts["classify_system"]
|
||||
|
||||
for key, value in report_dict.items():
|
||||
for key, value in tqdm(report_dict.items()):
|
||||
if not key.endswith(".pdf"):
|
||||
continue
|
||||
file_name = key
|
||||
|
||||
Reference in New Issue
Block a user