Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CML Github Workflow #33

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
18 changes: 12 additions & 6 deletions .github/workflows/cml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,22 @@ jobs:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: iterative/setup-cml@v1
- uses: iterative/setup-cml@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install requirements
run: |
pip3 install -r requirements.txt
- name: Get data
run: |
python3 get_data.py
- name: Train model
run: |
python3 train.py
- name: Create PR with metrics
env:
repo_token: ${{ secrets.GITHUB_TOKEN }}
run: |
pip3 install -r requirements.txt
python train.py

# Create CML report
cml comment create --pr --publish metrics.txt
cml pr create .
cml comment create --target=pr --publish metrics.txt
5 changes: 2 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
setuptools
scikit-learn
matplotlib
scikit-learn==1.3.2
matplotlib==3.8.2
4 changes: 2 additions & 2 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os

from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import plot_confusion_matrix
from sklearn.metrics import ConfusionMatrixDisplay
import matplotlib.pyplot as plt
import numpy as np

Expand All @@ -29,5 +29,5 @@
outfile.write(metrics)

# Plot it
disp = plot_confusion_matrix(clf, X_test, y_test, normalize="true", cmap=plt.cm.Blues)
disp = ConfusionMatrixDisplay.from_estimator(clf, X_test, y_test, normalize="true", cmap=plt.cm.Blues)
plt.savefig("plot.png")