diff --git a/rdagent/components/coder/factor_coder/factor.py b/rdagent/components/coder/factor_coder/factor.py index 10c354e9..b1685cd3 100644 --- a/rdagent/components/coder/factor_coder/factor.py +++ b/rdagent/components/coder/factor_coder/factor.py @@ -138,7 +138,7 @@ class FactorFBWorkspace(FBWorkspace): ) elif self.target_task.version == 2: # TODO you can change the name of the data folder for a better understanding - source_data_path = Path(FACTOR_IMPLEMENT_SETTINGS.data_folder) / KAGGLE_IMPLEMENT_SETTING.competition + source_data_path = Path(KAGGLE_IMPLEMENT_SETTING.local_data_path) / KAGGLE_IMPLEMENT_SETTING.competition source_data_path.mkdir(exist_ok=True, parents=True) code_path = self.workspace_path / f"factor.py" diff --git a/rdagent/scenarios/kaggle/experiment/forest-cover-type-prediction_template/fea_share_preprocess.py b/rdagent/scenarios/kaggle/experiment/forest-cover-type-prediction_template/fea_share_preprocess.py index 251c322b..464c9bac 100644 --- a/rdagent/scenarios/kaggle/experiment/forest-cover-type-prediction_template/fea_share_preprocess.py +++ b/rdagent/scenarios/kaggle/experiment/forest-cover-type-prediction_template/fea_share_preprocess.py @@ -27,13 +27,13 @@ def preprocess_script(): """ This method applies the preprocessing steps to the training, validation, and test datasets. """ - if os.path.exists("X_train.pkl"): - X_train = pd.read_pickle("X_train.pkl") - X_valid = pd.read_pickle("X_valid.pkl") - y_train = pd.read_pickle("y_train.pkl") - y_valid = pd.read_pickle("y_valid.pkl") - X_test = pd.read_pickle("X_test.pkl") - others = pd.read_pickle("others.pkl") + if os.path.exists("/kaggle/input/X_train.pkl"): + X_train = pd.read_pickle("/kaggle/input/X_train.pkl") + X_valid = pd.read_pickle("/kaggle/input/X_valid.pkl") + y_train = pd.read_pickle("/kaggle/input/y_train.pkl") + y_valid = pd.read_pickle("/kaggle/input/y_valid.pkl") + X_test = pd.read_pickle("/kaggle/input/X_test.pkl") + others = pd.read_pickle("/kaggle/input/others.pkl") return X_train, X_valid, y_train, y_valid, X_test, *others diff --git a/rdagent/scenarios/kaggle/experiment/meta_tpl/fea_share_preprocess.py b/rdagent/scenarios/kaggle/experiment/meta_tpl/fea_share_preprocess.py index d996a5b9..c0ef8819 100644 --- a/rdagent/scenarios/kaggle/experiment/meta_tpl/fea_share_preprocess.py +++ b/rdagent/scenarios/kaggle/experiment/meta_tpl/fea_share_preprocess.py @@ -84,13 +84,13 @@ def preprocess_script(): """ This method applies the preprocessing steps to the training, validation, and test datasets. """ - if os.path.exists("/kaggle/preprocessed_data/X_train.pkl"): - X_train = pd.read_pickle("/kaggle/preprocessed_data/X_train.pkl") - X_valid = pd.read_pickle("/kaggle/preprocessed_data/X_valid.pkl") - y_train = pd.read_pickle("/kaggle/preprocessed_data/y_train.pkl") - y_valid = pd.read_pickle("/kaggle/preprocessed_data/y_valid.pkl") - X_test = pd.read_pickle("/kaggle/preprocessed_data/X_test.pkl") - others = pd.read_pickle("/kaggle/preprocessed_data/others.pkl") + if os.path.exists("/kaggle/input/X_train.pkl"): + X_train = pd.read_pickle("/kaggle/input/X_train.pkl") + X_valid = pd.read_pickle("/kaggle/input/X_valid.pkl") + y_train = pd.read_pickle("/kaggle/input/y_train.pkl") + y_valid = pd.read_pickle("/kaggle/input/y_valid.pkl") + X_test = pd.read_pickle("/kaggle/input/X_test.pkl") + others = pd.read_pickle("/kaggle/input/others.pkl") return X_train, X_valid, y_train, y_valid, X_test, *others X_train, X_valid, y_train, y_valid = prepreprocess() diff --git a/rdagent/scenarios/kaggle/experiment/playground-series-s4e8_template/fea_share_preprocess.py b/rdagent/scenarios/kaggle/experiment/playground-series-s4e8_template/fea_share_preprocess.py index 57cbd662..c0ef8819 100644 --- a/rdagent/scenarios/kaggle/experiment/playground-series-s4e8_template/fea_share_preprocess.py +++ b/rdagent/scenarios/kaggle/experiment/playground-series-s4e8_template/fea_share_preprocess.py @@ -84,13 +84,13 @@ def preprocess_script(): """ This method applies the preprocessing steps to the training, validation, and test datasets. """ - if os.path.exists("X_train.pkl"): - X_train = pd.read_pickle("X_train.pkl") - X_valid = pd.read_pickle("X_valid.pkl") - y_train = pd.read_pickle("y_train.pkl") - y_valid = pd.read_pickle("y_valid.pkl") - X_test = pd.read_pickle("X_test.pkl") - others = pd.read_pickle("others.pkl") + if os.path.exists("/kaggle/input/X_train.pkl"): + X_train = pd.read_pickle("/kaggle/input/X_train.pkl") + X_valid = pd.read_pickle("/kaggle/input/X_valid.pkl") + y_train = pd.read_pickle("/kaggle/input/y_train.pkl") + y_valid = pd.read_pickle("/kaggle/input/y_valid.pkl") + X_test = pd.read_pickle("/kaggle/input/X_test.pkl") + others = pd.read_pickle("/kaggle/input/others.pkl") return X_train, X_valid, y_train, y_valid, X_test, *others X_train, X_valid, y_train, y_valid = prepreprocess() diff --git a/rdagent/scenarios/kaggle/experiment/playground-series-s4e9_template/fea_share_preprocess.py b/rdagent/scenarios/kaggle/experiment/playground-series-s4e9_template/fea_share_preprocess.py index 34503326..21fc1652 100644 --- a/rdagent/scenarios/kaggle/experiment/playground-series-s4e9_template/fea_share_preprocess.py +++ b/rdagent/scenarios/kaggle/experiment/playground-series-s4e9_template/fea_share_preprocess.py @@ -81,13 +81,13 @@ def preprocess_script(): """ This method applies the preprocessing steps to the training, validation, and test datasets. """ - if os.path.exists("X_train.pkl"): - X_train = pd.read_pickle("X_train.pkl") - X_valid = pd.read_pickle("X_valid.pkl") - y_train = pd.read_pickle("y_train.pkl") - y_valid = pd.read_pickle("y_valid.pkl") - X_test = pd.read_pickle("X_test.pkl") - others = pd.read_pickle("others.pkl") + if os.path.exists("/kaggle/input/X_train.pkl"): + X_train = pd.read_pickle("/kaggle/input/X_train.pkl") + X_valid = pd.read_pickle("/kaggle/input/X_valid.pkl") + y_train = pd.read_pickle("/kaggle/input/y_train.pkl") + y_valid = pd.read_pickle("/kaggle/input/y_valid.pkl") + X_test = pd.read_pickle("/kaggle/input/X_test.pkl") + others = pd.read_pickle("/kaggle/input/others.pkl") return X_train, X_valid, y_train, y_valid, X_test, *others X_train, X_valid, y_train, y_valid = prepreprocess() diff --git a/rdagent/scenarios/kaggle/experiment/scenario.py b/rdagent/scenarios/kaggle/experiment/scenario.py index 20f63f14..dc44f8e6 100644 --- a/rdagent/scenarios/kaggle/experiment/scenario.py +++ b/rdagent/scenarios/kaggle/experiment/scenario.py @@ -97,7 +97,7 @@ Competition Features: {self.competition_features} @property def source_data(self) -> str: - data_folder = Path(FACTOR_IMPLEMENT_SETTINGS.data_folder) / self.competition + data_folder = Path(KAGGLE_IMPLEMENT_SETTING.local_data_path) / self.competition if (data_folder / "X_valid.pkl").exists(): X_valid = pd.read_pickle(data_folder / "X_valid.pkl") diff --git a/rdagent/scenarios/kaggle/experiment/sf-crime_template/fea_share_preprocess.py b/rdagent/scenarios/kaggle/experiment/sf-crime_template/fea_share_preprocess.py index 988e9b70..e75786c9 100644 --- a/rdagent/scenarios/kaggle/experiment/sf-crime_template/fea_share_preprocess.py +++ b/rdagent/scenarios/kaggle/experiment/sf-crime_template/fea_share_preprocess.py @@ -102,13 +102,13 @@ def preprocess_script(): """ This method applies the preprocessing steps to the training, validation, and test datasets. """ - if os.path.exists("X_train.pkl"): - X_train = pd.read_pickle("X_train.pkl") - X_valid = pd.read_pickle("X_valid.pkl") - y_train = pd.read_pickle("y_train.pkl") - y_valid = pd.read_pickle("y_valid.pkl") - X_test = pd.read_pickle("X_test.pkl") - others = pd.read_pickle("others.pkl") + if os.path.exists("/kaggle/input/X_train.pkl"): + X_train = pd.read_pickle("/kaggle/input/X_train.pkl") + X_valid = pd.read_pickle("/kaggle/input/X_valid.pkl") + y_train = pd.read_pickle("/kaggle/input/y_train.pkl") + y_valid = pd.read_pickle("/kaggle/input/y_valid.pkl") + X_test = pd.read_pickle("/kaggle/input/X_test.pkl") + others = pd.read_pickle("/kaggle/input/others.pkl") return X_train, X_valid, y_train, y_valid, X_test, *others X_train, X_valid, y_train, y_valid, test, category_encoder, test_ids = prepreprocess() diff --git a/rdagent/scenarios/kaggle/experiment/spaceship-titanic_template/fea_share_preprocess.py b/rdagent/scenarios/kaggle/experiment/spaceship-titanic_template/fea_share_preprocess.py index 9b62863c..4d8ffcc0 100644 --- a/rdagent/scenarios/kaggle/experiment/spaceship-titanic_template/fea_share_preprocess.py +++ b/rdagent/scenarios/kaggle/experiment/spaceship-titanic_template/fea_share_preprocess.py @@ -78,13 +78,13 @@ def preprocess_script(): """ This method applies the preprocessing steps to the training, validation, and test datasets. """ - if os.path.exists("X_train.pkl"): - X_train = pd.read_pickle("X_train.pkl") - X_valid = pd.read_pickle("X_valid.pkl") - y_train = pd.read_pickle("y_train.pkl") - y_valid = pd.read_pickle("y_valid.pkl") - X_test = pd.read_pickle("X_test.pkl") - others = pd.read_pickle("others.pkl") + if os.path.exists("/kaggle/input/X_train.pkl"): + X_train = pd.read_pickle("/kaggle/input/X_train.pkl") + X_valid = pd.read_pickle("/kaggle/input/X_valid.pkl") + y_train = pd.read_pickle("/kaggle/input/y_train.pkl") + y_valid = pd.read_pickle("/kaggle/input/y_valid.pkl") + X_test = pd.read_pickle("/kaggle/input/X_test.pkl") + others = pd.read_pickle("/kaggle/input/others.pkl") return X_train, X_valid, y_train, y_valid, X_test, *others X_train, X_valid, y_train, y_valid = prepreprocess() diff --git a/rdagent/scenarios/kaggle/experiment/workspace.py b/rdagent/scenarios/kaggle/experiment/workspace.py index 93b6bfab..c6d4633e 100644 --- a/rdagent/scenarios/kaggle/experiment/workspace.py +++ b/rdagent/scenarios/kaggle/experiment/workspace.py @@ -69,15 +69,13 @@ class KGFBWorkspace(FBWorkspace): kgde = KGDockerEnv(KAGGLE_IMPLEMENT_SETTING.competition) kgde.prepare() - running_extra_volume = { - ( - Path(FACTOR_IMPLEMENT_SETTINGS.data_folder) / KAGGLE_IMPLEMENT_SETTING.competition - ).absolute(): "/kaggle/preprocessed_data" - } + running_extra_volume = {} if KAGGLE_IMPLEMENT_SETTING.competition: - running_extra_volume[ - KAGGLE_IMPLEMENT_SETTING.local_data_path + "/" + KAGGLE_IMPLEMENT_SETTING.competition - ] = "/kaggle/input" + running_extra_volume = { + KAGGLE_IMPLEMENT_SETTING.local_data_path + "/" + KAGGLE_IMPLEMENT_SETTING.competition: "/kaggle/input" + } + else: + running_extra_volume = {} execute_log = kgde.run( local_path=str(self.workspace_path),