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
18 changes: 13 additions & 5 deletions .github/workflows/metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,22 @@ jobs:
metrics:
runs-on: ubuntu-latest
container: docker://ghcr.io/iterative/cml:0-dvc2-base1
env:
POETRY_VIRTUALENVS_CREATE: false
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install -e .
pip3 install .
pip3 install pytest
pip3 install tabulate # required to md export
pip3 install kaleido # required for plotly export
- name: Train model
run: |
pytest tests/test_model_performance.py
run: pytest tests/test_model_performance.py
- name: Download metrics from main
uses: dawidd6/action-download-artifact@v2
with:
Expand All @@ -49,13 +51,19 @@ jobs:
echo "## Model Training" >> report.md
echo "### PeytonManning" >> report.md
cml asset publish tests/metrics/PeytonManning.svg --md >> report.md
echo "### PeytonManning_test30" >> report.md
cml asset publish tests/metrics/PeytonManning_test30.svg --md >> report.md
echo "### YosemiteTemps" >> report.md
cml asset publish tests/metrics/YosemiteTemps.svg --md >> report.md
echo "### YosemiteTemps_test20" >> report.md
cml asset publish tests/metrics/YosemiteTemps_test20.svg --md >> report.md
echo "### AirPassengers" >> report.md
cml asset publish tests/metrics/AirPassengers.svg --md >> report.md
echo "### AirPassengers_test30" >> report.md
cml asset publish tests/metrics/AirPassengers_test30.svg --md >> report.md
echo "\n</details>" >> report.md
# Post reports as comments in GitHub PRs
cml comment update --pr report.md # post to PR
cml comment update --target=pr report.md # post to PR
cml check create --title=ModelReport report.md # update status of check in PR
- name: Upload metrics if on main
uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ live = ["livelossplot"]
black = { extras = ["jupyter"], version = "^23.1.0" }
flake8 = "^5.0.4"
isort = "^5.11.5"
pytest = "^7.2.2"
kaleido = "0.2.1"
pytest-cov = "^4.0.0"
tabulate = "^0.9" # Used in CI model metrics tests only, for PR bot
pytest = "^7.2"
pytest-cov = "^4.0"
kaleido = "0.2.1" # required for plotly static image export
tabulate = "^0.9" # Used in model metrics CI only; md export for github-actions bot

[tool.poetry.group.docs]
optional = true
Expand Down
4 changes: 2 additions & 2 deletions tests/test_model_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ def test_YosemiteTemps_test20():
accuracy_metrics["time"] = round(end - start, 2)
accuracy_metrics["system_performance"] = round(system_speed, 5)
accuracy_metrics["system_std"] = round(std, 5)
with open(os.path.join(DIR, "tests", "metrics", "YosemiteTemps_test30.json"), "w") as outfile:
with open(os.path.join(DIR, "tests", "metrics", "YosemiteTemps_test20.json"), "w") as outfile:
json.dump(accuracy_metrics, outfile)

create_metrics_plot(metrics).write_image(os.path.join(DIR, "tests", "metrics", "YosemiteTemps_test30.svg"))
create_metrics_plot(metrics).write_image(os.path.join(DIR, "tests", "metrics", "YosemiteTemps_test20.svg"))


def test_AirPassengers():
Expand Down