fix: fix some bugs in the ensemble component (#595)

* allow the LLM in the ensemble to focus on the significance of metrics

* fix a bug in feedback

* prun spec

* fix a bug in ensemble

* delete unnecessary prompts

* fix the logic in spec

* generalize dataset split
This commit is contained in:
Yuante Li
2025-02-14 15:32:40 +08:00
committed by GitHub
parent 1a44a954df
commit c321ebfbcb
4 changed files with 55 additions and 41 deletions
@@ -16,6 +16,21 @@ from load_data import load_data
from feature import feat_eng
from ensemble import ensemble_workflow
def print_preds_info(model_name, data_type, preds):
if preds is None:
print(f"Model {model_name} {data_type} predictions: None")
else:
print(f"Model {model_name} {data_type} predictions shape: {preds.shape}")
if isinstance(preds, pd.DataFrame):
print(preds.head())
elif isinstance(preds, (np.ndarray, torch.Tensor, tf.Tensor)):
print(pd.DataFrame(preds).head())
elif isinstance(preds, list):
print(pd.DataFrame(preds[:5]))
else:
print(f"Unknown prediction type: {type(preds)}")
X, y, test_X, test_ids = load_data()
X, y, test_X = feat_eng(X, y, test_X)
train_X, val_X, train_y, val_y = train_test_split(X, y, test_size=0.2, random_state=42)
@@ -34,6 +49,8 @@ val_preds_dict["{{mn}}"], test_preds_dict["{{mn}}"], _ = {{mn}}_workflow(
val_y=val_y,
test_X=test_X
)
print_preds_info("{{mn}}", "test", test_preds_dict["{{mn}}"])
{% endfor %}
for key in val_preds_dict.keys():
@@ -54,6 +71,8 @@ for key in val_preds_dict.keys():
# Run ensemble
final_pred = ensemble_workflow(test_preds_dict, val_preds_dict, val_y)
print_preds_info("ensemble", "test", final_pred)
# Check type
pred_type = type(next(iter(test_preds_dict.values())))
assert isinstance(final_pred, pred_type), (
@@ -9,7 +9,7 @@ ensemble_coder:
Your specific task as follows:
{{ task_desc }}
Here is the competition information for this task:
## Competition Information for This Task
{{ competition_info }}
{% if queried_similar_successful_knowledge|length != 0 or queried_former_failed_knowledge|length != 0 %}
@@ -97,7 +97,7 @@ ensemble_eval:
{
"execution": "Describe how well the ensemble executed, including any errors or issues encountered. Retain all error messages and traceback details.",
"return_checking": "Detail the checks performed on the ensemble results, including shape and value validation.",
"code": "Assess code quality, readability, and adherence to specifications. Consider efficiency, including whether the code utilizes multi-threading or GPU acceleration for optimization.",
"code": "Assess code quality, readability, and adherence to specifications.",
"final_decision": <true/false>
}
```