train #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: train | |
env: | |
AWS_REGION: us-east-1 # set this to your preferred AWS region, e.g. us-west-1 | |
on: | |
pull_request: | |
branches: main | |
workflow_dispatch: | |
inputs: | |
PROJECT_NAME: | |
description: 'Name of the project' | |
required: true | |
default: 'cicd-ai' | |
workflow_run: | |
workflows: ["hp-tuning"] | |
types: | |
- completed | |
permissions: write-all | |
jobs: | |
train: | |
runs-on: ubuntu-latest | |
#if: startsWith(github.head_ref, 'train/') | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Printout project name env | |
run: echo $PROJECT_NAME >> $GITHUB_ENV | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
- name: Setup CML | |
uses: iterative/setup-cml@v1 | |
- name: Setup DVC | |
uses: iterative/setup-dvc@v1 | |
- name: Install dependencies | |
run: | | |
pipx install poetry | |
poetry install | |
- name: Run DVC pipeline for CML | |
run: | | |
poetry run dvc pull | |
poetry run dvc repro train | |
- name: Write CML report | |
env: | |
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
poetry run dvc metrics show --md >> report.md | |
git fetch --prune | |
poetry run dvc metrics diff --md main >> report.md | |
dvc plots diff \ | |
--target metrics/predictions.csv \ | |
--template confusion_normalized \ | |
-x true_label \ | |
-y predicted_label \ | |
--title "Confusion Matrix" \ | |
--show-vega master > vega.json | |
vl2png vega.json -s 1.5 > confusion_matrix.png | |
echo '![](./confusion_matrix.png "Confusion Matrix")' >> report.md | |
dvc plots diff \ | |
--target metrics/roc_curve.csv \ | |
--template: simple | |
-x: fpr | |
-y: tpr | |
--x_label: "False Positive Rate" | |
--y_label: "True Positive Rate" | |
--title: "ROC Curve" | |
--show-vega master > vega.json | |
vl2png vega.json -s 1.5 > roc_curve.png | |
echo '![](./roc_curve.png "ROC Curve")' >> report.md | |
# Create comment from markdown report | |
cml comment create report.md |