Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
21 changes: 16 additions & 5 deletions day5/演習2/black_check.py
Original file line number Diff line number Diff line change
@@ -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
return a + b
1 change: 1 addition & 0 deletions day5/演習2/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import time
import great_expectations as gx


class DataLoader:
"""データロードを行うクラス"""

Expand Down
15 changes: 15 additions & 0 deletions day5/演習3/tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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():
"""モデルファイルが存在するか確認"""
Expand Down
Loading