From 2cbd87c635f73426d5b4df66ec9b9908a3aa867b Mon Sep 17 00:00:00 2001 From: Haoran Pan <167847254+TPLin22@users.noreply.github.com> Date: Mon, 16 Sep 2024 15:36:16 +0800 Subject: [PATCH] modify prompts to run kaggle loops (#266) --- rdagent/log/ui/app.py | 1 - .../scenarios/kaggle/experiment/meta_tpl/model/model_xgb.py | 2 +- rdagent/scenarios/kaggle/experiment/prompts.yaml | 3 +++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rdagent/log/ui/app.py b/rdagent/log/ui/app.py index 0cf5db60..d8ce2c56 100644 --- a/rdagent/log/ui/app.py +++ b/rdagent/log/ui/app.py @@ -531,7 +531,6 @@ def feedback_window(): ) -@st.fragment def evolving_window(): title = "Development🛠️" if isinstance(state.scenario, SIMILAR_SCENARIOS) else "Development🛠️ (evolving coder)" st.subheader(title, divider="green", anchor="_development") diff --git a/rdagent/scenarios/kaggle/experiment/meta_tpl/model/model_xgb.py b/rdagent/scenarios/kaggle/experiment/meta_tpl/model/model_xgb.py index 839a39e9..74fb6399 100644 --- a/rdagent/scenarios/kaggle/experiment/meta_tpl/model/model_xgb.py +++ b/rdagent/scenarios/kaggle/experiment/meta_tpl/model/model_xgb.py @@ -20,7 +20,7 @@ def fit(X_train: pd.DataFrame, y_train: pd.DataFrame, X_valid: pd.DataFrame, y_v # TODO: for quick running.... params = {} - num_round = 2 + num_round = 50 evallist = [(dtrain, "train"), (dvalid, "eval")] bst = xgb.train(params, dtrain, num_round, evallist) diff --git a/rdagent/scenarios/kaggle/experiment/prompts.yaml b/rdagent/scenarios/kaggle/experiment/prompts.yaml index 629ddc95..eb1783bd 100644 --- a/rdagent/scenarios/kaggle/experiment/prompts.yaml +++ b/rdagent/scenarios/kaggle/experiment/prompts.yaml @@ -96,6 +96,9 @@ kg_feature_interface: |- 2. Ensure that the index of the output DataFrame matches the index of the original DataFrame. For example: Incorrect: `normalized_df = pd.DataFrame(normalized_features, columns=X.columns)` Correct: `normalized_df = pd.DataFrame(normalized_features, columns=X.columns, index=X.index)` + 3. Ensure consistency in column count across train, validation, and test sets post-feature engineering. For example, fit PCA on the training set and apply the same transformation to validation and test sets to keep the number of columns aligned, and use OneHotEncoder may also cause different number of columns. + 4. Ensure that the generation of new features does not drastically increase the number of columns, which can slow down data processing. For example, avoid creating pairwise interactions for all features, as this would lead to a quadratic increase in the number of columns. + 5. Avoids raising a `ValueError` or any other exceptions that could interrupt the main program's flow. The code should not include checks that could potentially lead to a `ValueError`. Instead, focus on writing robust and fault-tolerant feature engineering functions that handle edge cases and missing data gracefully, without stopping the program. kg_model_interface: |- Your code should contain several parts: