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
15 changes: 7 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ on:

jobs:
test:
runs-on: ubuntu-latest
runs-on: self-hosted

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Show Python
run: python3 --version

- name: Install dependencies
run: |
Expand All @@ -28,7 +26,8 @@ jobs:
env:
PYTHONPATH: ${{ github.workspace }}
run: |
python -m pytest -q --cov=prediction_pipeline_demo --cov-report=term-missing --cov-fail-under=50
python -m pytest -q --cov=prediction_pipeline_demo --cov-report=term-missing --cov-fail-under=70

# TODO: Add a step here to run the demo pipeline end-to-end
# The goal is to execute prediction_pipeline_demo.py so CI logs show the model’s R^2 score.
- name: Run demo ML pipeline
run: |
python prediction_pipeline_demo.py
14 changes: 8 additions & 6 deletions tests/test_prediction_pipeline_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,22 @@ def feature_target_sample(housing_data_sample):

def test_data_split_returns_four_parts(feature_target_sample):
# TODO(1): Uncomment the line below to get the split
# parts = data_split(*feature_target_sample)
parts = data_split(*feature_target_sample)
# TODO(2): Add assertions to check:
# - parts is a tuple
# - tuple has exactly 4 elements
pass
assert isinstance(parts, tuple)
assert len(parts) == 4


def test_end_to_end_train_and_eval(feature_target_sample):
# TODO(3): Uncomment these lines to train and evaluate the model
# X_train, X_test, y_train, y_test = data_split(*feature_target_sample)
# model = train_model(X_train, y_train)
# score = eval_model(X_test, y_test, model)
X_train, X_test, y_train, y_test = data_split(*feature_target_sample)
model = train_model(X_train, y_train)
score = eval_model(X_test, y_test, model)
# TODO(4): Add assertions to check:
# - score is a float
# - score is finite (not NaN or inf)
pass
assert isinstance(score, float)
assert np.isfinite(score)