diff --git a/expo/README.md b/expo/README.md index 0d47ab3e4..55ea7eed4 100644 --- a/expo/README.md +++ b/expo/README.md @@ -169,38 +169,8 @@ #### Run 运行下面脚本获取运行结果,在当前目录下将生成一个 log 文件夹以及 workspace 文件夹 log 文件夹中将包含实验使用配置以及生成方案记录,workspace 文件夹下将保存 aide 最后生成的结果文件 -```python -import aide -import os -import time - -os.environ["OPENAI_API_KEY"] = "sk-xxx" -os.environ["OPENAI_BASE_URL"] = "your url" -start_time = time.time() -data_dir = "xxx/data/titanic" -goal = f""" -# User requirement -({data_dir}, 'This is a 04_titanic dataset. Your goal is to predict the target column `Survived`.\nPerform data analysis, data preprocessing, feature engineering, and modeling to predict the target. \nReport f1 on the eval data. Do not plot or make any visualizations.\n') - -# Data dir -training (with labels): train.csv -testing (without labels): test.csv -dataset description: dataset_info.json (You can use this file to get additional information about the dataset)""" - -exp = aide.Experiment( - data_dir=data_dir, # replace this with your own directory - goal=goal, - eval="f1", # replace with your own evaluation metric -) - -best_solution = exp.run(steps=10) - -print(f"Best solution has validation metric: {best_solution.valid_metric}") -print(f"Best solution code: {best_solution.code}") -end_time = time.time() -execution_time = end_time - start_time - -print(f"run time : {execution_time} seconds") +``` +python experimenter/aide.py ``` ### Autogluon diff --git a/expo/experimenter/aide.py b/expo/experimenter/aide.py new file mode 100644 index 000000000..fb71dbdab --- /dev/null +++ b/expo/experimenter/aide.py @@ -0,0 +1,31 @@ +import aide +import os +import time + +os.environ["OPENAI_API_KEY"] = "sk-xxx" +os.environ["OPENAI_BASE_URL"] = "your url" +start_time = time.time() +data_dir = "xxx/data/titanic" +goal = f""" +# User requirement +({data_dir}, 'This is a 04_titanic dataset. Your goal is to predict the target column `Survived`.\nPerform data analysis, data preprocessing, feature engineering, and modeling to predict the target. \nReport f1 on the eval data. Do not plot or make any visualizations.\n') + +# Data dir +training (with labels): train.csv +testing (without labels): test.csv +dataset description: dataset_info.json (You can use this file to get additional information about the dataset)""" + +exp = aide.Experiment( + data_dir=data_dir, # replace this with your own directory + goal=goal, + eval="f1", # replace with your own evaluation metric +) + +best_solution = exp.run(steps=10) + +print(f"Best solution has validation metric: {best_solution.valid_metric}") +print(f"Best solution code: {best_solution.code}") +end_time = time.time() +execution_time = end_time - start_time + +print(f"run time : {execution_time} seconds") \ No newline at end of file