Skip to content
Open
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
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: ML Pipeline CI

on:
# push:
# branches: [ main, master ]
push:
branches: [ main, master, my-feature-branch ]
pull_request:
branches: [ main, master ]
branches: [ main, master, my-feature-branch ]

jobs:
test:
Expand Down
Binary file modified day5/演習3/models/titanic_model.pkl
Binary file not shown.
13 changes: 12 additions & 1 deletion day5/演習3/tests/test_model.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import os
import pytest
import pandas as pd
import numpy as np
import pickle
import time
import os # ← これを追加!
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
Expand All @@ -17,6 +17,17 @@
MODEL_DIR = os.path.join(os.path.dirname(__file__), "../models")
MODEL_PATH = os.path.join(MODEL_DIR, "titanic_model.pkl")

BASELINE_ACCURACY = 0.78 # 過去バージョンの精度などで設定


def test_accuracy_vs_baseline(train_model):
model, X_test, y_test = train_model
y_pred = model.predict(X_test)
accuracy = accuracy_score(y_test, y_pred)
assert (
accuracy >= BASELINE_ACCURACY
), f"モデル精度がベースラインを下回っています: {accuracy} < {BASELINE_ACCURACY}"


@pytest.fixture
def sample_data():
Expand Down
2 changes: 2 additions & 0 deletions new_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ここにコードを書く
print('Hello from new_file!')