feat: a unified CoSTEER to fit more scenarios (#491)

* Use ExtendedBaseSettings to replace BaseSettings

* update a more general way to pass the default setting

* update all code

* fix CI

* fix CI

* fix qlib scenario

* fix CI

* fix CI

* fix CI & add data science interfaces

* remove redundant code

* abandon costeer knowledge base v1

---------

Co-authored-by: Xu Yang <xuyang1@microsoft.com>
Co-authored-by: XianBW <36835909+XianBW@users.noreply.github.com>
This commit is contained in:
Xu Yang
2024-11-25 16:27:34 +08:00
committed by GitHub
parent a4602bdcc2
commit fce241b9f9
72 changed files with 1793 additions and 1817 deletions
@@ -1,18 +1,9 @@
from pathlib import Path
from typing import Literal, Union
from pydantic_settings import BaseSettings
SELECT_METHOD = Literal["random", "scheduler"]
from rdagent.components.coder.CoSTEER.config import CoSTEERSettings
from rdagent.core.conf import ExtendedSettingsConfigDict
class FactorImplementSettings(BaseSettings):
class Config:
env_prefix = "FACTOR_CODER_"
"""Use `FACTOR_CODER_` as prefix for environment variables"""
coder_use_cache: bool = False
"""Indicates whether to use cache for the coder"""
class FactorCoSTEERSettings(CoSTEERSettings):
model_config = ExtendedSettingsConfigDict(env_prefix="FACTOR_CoSTEER_")
data_folder: str = "git_ignore_folder/factor_implementation_source_data"
"""Path to the folder containing financial data (default is fundamental data in Qlib)"""
@@ -20,21 +11,6 @@ class FactorImplementSettings(BaseSettings):
data_folder_debug: str = "git_ignore_folder/factor_implementation_source_data_debug"
"""Path to the folder containing partial financial data (for debugging)"""
# TODO: the factor implement specific settings should not appear in this settings
# Evolving should have a method specific settings
# evolving related config
fail_task_trial_limit: int = 20
v1_query_former_trace_limit: int = 5
v1_query_similar_success_limit: int = 5
v2_query_component_limit: int = 1
v2_query_error_limit: int = 1
v2_query_former_trace_limit: int = 1
v2_add_fail_attempt_to_latest_successful_execution: bool = False
v2_error_summary: bool = False
v2_knowledge_sampler: float = 1.0
simple_background: bool = False
"""Whether to use simple background information for code feedback"""
@@ -44,20 +20,8 @@ class FactorImplementSettings(BaseSettings):
select_method: str = "random"
"""Method for the selection of factors implementation"""
select_threshold: int = 10
"""Threshold for the number of factor selections"""
max_loop: int = 10
"""Maximum number of task implementation loops"""
knowledge_base_path: Union[str, None] = None
"""Path to the knowledge base"""
new_knowledge_base_path: Union[str, None] = None
"""Path to the new knowledge base"""
python_bin: str = "python"
"""Path to the Python binary"""
FACTOR_IMPLEMENT_SETTINGS = FactorImplementSettings()
FACTOR_COSTEER_SETTINGS = FactorCoSTEERSettings()