|
7 | 7 | from rdagent.components.coder.factor_coder.factor import FactorTask |
8 | 8 | from rdagent.components.runner import CachedRunner |
9 | 9 | from rdagent.components.runner.conf import RUNNER_SETTINGS |
10 | | -from rdagent.core.exception import ModelEmptyError |
| 10 | +from rdagent.core.exception import FactorEmptyError, ModelEmptyError |
11 | 11 | from rdagent.core.experiment import ASpecificExp |
12 | 12 | from rdagent.oai.llm_utils import md5_hash |
13 | 13 | from rdagent.scenarios.kaggle.experiment.kaggle_experiment import ( |
@@ -41,12 +41,20 @@ class KGModelRunner(KGCachedRunner[KGModelExperiment]): |
41 | 41 | def develop(self, exp: KGModelExperiment) -> KGModelExperiment: |
42 | 42 | self.build_from_SOTA(exp) |
43 | 43 | if exp.sub_workspace_list[0].target_task.model_type == "XGBoost": |
| 44 | + if exp.sub_workspace_list[0].code_dict == {}: |
| 45 | + raise ModelEmptyError("No model is implemented") |
44 | 46 | exp.experiment_workspace.inject_code(**{"model_xgb.py": exp.sub_workspace_list[0].code_dict["model.py"]}) |
45 | 47 | elif exp.sub_workspace_list[0].target_task.model_type == "RandomForest": |
| 48 | + if exp.sub_workspace_list[0].code_dict == {}: |
| 49 | + raise ModelEmptyError("No model is implemented") |
46 | 50 | exp.experiment_workspace.inject_code(**{"model_rf.py": exp.sub_workspace_list[0].code_dict["model.py"]}) |
47 | 51 | elif exp.sub_workspace_list[0].target_task.model_type == "LightGBM": |
| 52 | + if exp.sub_workspace_list[0].code_dict == {}: |
| 53 | + raise ModelEmptyError("No model is implemented") |
48 | 54 | exp.experiment_workspace.inject_code(**{"model_lgb.py": exp.sub_workspace_list[0].code_dict["model.py"]}) |
49 | 55 | elif exp.sub_workspace_list[0].target_task.model_type == "NN": |
| 56 | + if exp.sub_workspace_list[0].code_dict == {}: |
| 57 | + raise ModelEmptyError("No model is implemented") |
50 | 58 | exp.experiment_workspace.inject_code(**{"model_nn.py": exp.sub_workspace_list[0].code_dict["model.py"]}) |
51 | 59 | if RUNNER_SETTINGS.cache_result: |
52 | 60 | cache_hit, result = self.get_cache_result(exp) |
@@ -113,7 +121,7 @@ def develop(self, exp: KGFactorExperiment) -> KGFactorExperiment: |
113 | 121 | exp.experiment_workspace.data_description.append((sub_ws.target_task.get_task_information(), feature_shape)) |
114 | 122 | current_feature_file_count += 1 |
115 | 123 | if implemented_factor_count == 0: |
116 | | - raise ModelEmptyError("No factor is implemented") |
| 124 | + raise FactorEmptyError("No factor is implemented") |
117 | 125 |
|
118 | 126 | if RUNNER_SETTINGS.cache_result: |
119 | 127 | cache_hit, result = self.get_cache_result(exp) |
|
0 commit comments