diff --git a/rdagent/scenarios/kaggle/experiment/model_experiment.py b/rdagent/scenarios/kaggle/experiment/model_experiment.py index 889b161b..8cab9d21 100644 --- a/rdagent/scenarios/kaggle/experiment/model_experiment.py +++ b/rdagent/scenarios/kaggle/experiment/model_experiment.py @@ -1,6 +1,7 @@ import json from pathlib import Path +import pandas as pd from jinja2 import Environment, StrictUndefined from rdagent.components.coder.model_coder.model import ( @@ -77,12 +78,34 @@ class KGModelScenario(Scenario): competition_features=self.competition_features, ) ) - return background_prompt @property def source_data(self) -> str: - raise NotImplementedError("source_data is not implemented") + kaggle_conf = KGDockerConf() + data_path = Path(f"{kaggle_conf.share_data_path}/{self.competition}") + + csv_files = list(data_path.glob("*.csv")) + + if not csv_files: + return "No CSV files found in the specified path." + + dataset = pd.concat([pd.read_csv(file) for file in csv_files], ignore_index=True) + + simple_eda = dataset.info(buf=None) # Capture the info output + data_shape = dataset.shape + data_head = dataset.head() + + eda = ( + f"Basic Info about the data:\n{simple_eda}\n" + f"Shape of the dataset: {data_shape}\n" + f"Sample Data:\n{data_head}\n" + ) + + data_description = self.competition_descriptions.get("Data Description", "No description provided") + eda += f"\nData Description:\n{data_description}" + + return eda @property def output_format(self) -> str: