diff --git "a/day5/\346\274\224\347\277\2222/.github/workflows/ci.yml" "b/day5/\346\274\224\347\277\2222/.github/workflows/ci.yml" new file mode 100644 index 000000000..e69de29bb diff --git "a/day5/\346\274\224\347\277\2222/black_check.py" "b/day5/\346\274\224\347\277\2222/black_check.py" index 3158f952d..910a40c3a 100644 --- "a/day5/\346\274\224\347\277\2222/black_check.py" +++ "b/day5/\346\274\224\347\277\2222/black_check.py" @@ -1,7 +1,18 @@ +def say_hello(name): + print("Hello," + name + "!") # greet + + +def say_hello(name): + print("Hello," + name + "!") # greet + + +def add(a, b): + return a + b + + +def add(a, b): + return a + b + -def say_hello(name):print("Hello,"+name+"!") # greet -def say_hello(name):print("Hello," + name +"!") # greet -def add( a,b):return a+b -def add( a , b ):return a+b def add(a, b): - return a+b \ No newline at end of file + return a + b diff --git "a/day5/\346\274\224\347\277\2222/main.py" "b/day5/\346\274\224\347\277\2222/main.py" index 776b70e75..2b256b6c5 100644 --- "a/day5/\346\274\224\347\277\2222/main.py" +++ "b/day5/\346\274\224\347\277\2222/main.py" @@ -11,6 +11,7 @@ import time import great_expectations as gx + class DataLoader: """データロードを行うクラス""" diff --git "a/day5/\346\274\224\347\277\2223/tests/test_model.py" "b/day5/\346\274\224\347\277\2223/tests/test_model.py" index e11a19a5c..94ae727c2 100644 --- "a/day5/\346\274\224\347\277\2223/tests/test_model.py" +++ "b/day5/\346\274\224\347\277\2223/tests/test_model.py" @@ -12,6 +12,8 @@ from sklearn.compose import ColumnTransformer from sklearn.pipeline import Pipeline +BASELINE_PATH = pathlib.Path(__file__).resolve().parents[1] / "baseline.json" + # テスト用データとモデルパスを定義 DATA_PATH = os.path.join(os.path.dirname(__file__), "../data/Titanic.csv") MODEL_DIR = os.path.join(os.path.dirname(__file__), "../models") @@ -101,6 +103,19 @@ def train_model(sample_data, preprocessor): return model, X_test, y_test +def _load_baseline() -> float | None: + """baseline.json から accuracy を読む(無ければ None)""" + if BASELINE_PATH.exists(): + data = json.loads(BASELINE_PATH.read_text()) + return data.get("accuracy") + return None + +def _save_baseline(new_acc: float): + """精度が向上したとき baseline.json を更新""" + BASELINE_PATH.write_text(json.dumps( + {"accuracy": new_acc, "updated": datetime.utcnow().isoformat()}, + indent=2 + )) def test_model_exists(): """モデルファイルが存在するか確認"""