Files
NexQuant/test/utils/test_kaggle.py
T
you-n-g 7ffe284c12 feat: kaggle refactor (#489)
* init trail

* Add spec info

* auto unzip mlebench prepared data for out scenario

* successfully run example

* successfully run main

* simplify load traing

* extract load_from_raw_data

* split the fies(still buggy)
It should stop on ~20 epoch and reach the end

* some changes

* Fix bug to run example

* (success) until feature

* refine model and ensemble

* add metrics in ens.py

* update README &  spec.md

* ens change

* fix ens bug

* Delete rdagent/scenarios/kaggle/tpl_ex/aerial-cactus-identification/train.py

* add template_path in KG_conf

* fix test kaggle

* CI

* make test_import not check kaggle template codes

---------

Co-authored-by: Bowen Xian <xianbowen@outlook.com>
2024-11-20 17:01:18 +08:00

37 lines
1.2 KiB
Python

import unittest
from pathlib import Path
import nbformat
from rich import print
from rdagent.app.kaggle.conf import KAGGLE_IMPLEMENT_SETTING
from rdagent.oai.llm_utils import APIBackend
from rdagent.scenarios.kaggle.experiment.workspace import KGFBWorkspace
from rdagent.scenarios.kaggle.kaggle_crawler import download_data
from rdagent.utils.agent.ret import PythonAgentOut
from rdagent.utils.agent.tpl import T
class TestTpl(unittest.TestCase):
def test_competition_template(self):
"""
export KG_COMPETITION=<competition_name> before running this test
"""
competition = KAGGLE_IMPLEMENT_SETTING.competition
print(f"[bold orange]{competition}[/bold orange]")
download_data(competition)
ws = KGFBWorkspace(
template_folder_path=Path(__file__).parent.parent.parent
/ KAGGLE_IMPLEMENT_SETTING.template_path
/ f"{competition}",
)
print(ws.workspace_path)
ws.execute()
success = (ws.workspace_path / "submission.csv").exists()
self.assertTrue(success, "submission.csv is not generated")
# ws.clear()
if __name__ == "__main__":
unittest.main()