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

Cml test #9

Merged
merged 35 commits into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
02321fe
Create cml.yaml
dec1costello Oct 12, 2024
a33e551
Update cml.yaml
dec1costello Oct 12, 2024
912a477
Update cml.yaml
dec1costello Oct 12, 2024
4059798
Update cml.yaml
dec1costello Oct 12, 2024
5e26c05
Create report.md
dec1costello Oct 12, 2024
440be4f
Update train.py
dec1costello Oct 12, 2024
7e84c10
Update cml.yaml
dec1costello Oct 12, 2024
060159e
Update cml.yaml
dec1costello Oct 12, 2024
2177a90
Update cml.yaml
dec1costello Oct 12, 2024
c869634
Update cml.yaml
dec1costello Oct 12, 2024
05bcfdb
Update train.py
dec1costello Oct 12, 2024
bc2f39e
Update train.py
dec1costello Oct 12, 2024
d9ad5fd
Update cml.yaml
dec1costello Oct 12, 2024
3dd4bc7
Update cml.yaml
dec1costello Oct 12, 2024
cf7149e
Update cml.yaml
dec1costello Oct 12, 2024
b1a5b0f
Update cml.yaml
dec1costello Oct 12, 2024
a7b013b
Add model results and report
github-actions[bot] Oct 12, 2024
194f164
Update cml.yaml
dec1costello Oct 12, 2024
470a1a0
Add model results and report
github-actions[bot] Oct 12, 2024
839724d
Update cml.yaml
dec1costello Oct 12, 2024
e145934
Add model results and report
github-actions[bot] Oct 12, 2024
71e876c
Update cml.yaml
dec1costello Oct 12, 2024
75d1bb2
Add model results and report
github-actions[bot] Oct 13, 2024
6e13da6
Update cml.yaml
dec1costello Oct 13, 2024
946277b
Add model results and report
github-actions[bot] Oct 13, 2024
179729c
Update cml.yaml
dec1costello Oct 13, 2024
b3fbedf
Update cml.yaml
dec1costello Oct 13, 2024
bb2dd6c
Update cml.yaml
dec1costello Oct 13, 2024
83cda47
Update cml.yaml
dec1costello Oct 13, 2024
ba47ae7
Update cml.yaml
dec1costello Oct 13, 2024
9de53fe
Update train.py
dec1costello Oct 13, 2024
5d62212
Add model results and report
github-actions[bot] Oct 13, 2024
7e621cc
Delete .github/workflows/main.yml
dec1costello Oct 13, 2024
8eb82bd
Add model results and report
github-actions[bot] Oct 13, 2024
19c57a5
Merge branch 'main' into cml-test
dec1costello Oct 13, 2024
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
46 changes: 46 additions & 0 deletions .github/workflows/cml.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: model-training
on: [push]
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: iterative/setup-cml@v1

- name: Set up Python environment
run: |
python -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install -r Streamlit/requirements.txt

- name: Train model
run: |
source venv/bin/activate
python Streamlit/train.py

# Improve this .md
- name: Create report.md
run: |
cat Streamlit/results.txt > Streamlit/report.md
echo "![](feature_importance.png)" >> Streamlit/report.md
echo "![](residuals.png)" >> Streamlit/report.md

- name: Commit results and report
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add Streamlit/results.txt
git add Streamlit/report.md
git add Streamlit/feature_importance.png
git add Streamlit/residuals.png
git commit -m "Add model results and report"
git push

- name: Create CML Report
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
source venv/bin/activate
cml comment create Streamlit/report.md --token ${{ secrets.GITHUB_TOKEN }}
40 changes: 0 additions & 40 deletions .github/workflows/main.yml

This file was deleted.

Binary file added Streamlit/feature_importance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion Streamlit/report.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@

Training variance explained: 33.0%
Test variance explained: 32.0%
![](feature_importance.png)
![](residuals.png)
Binary file added Streamlit/residuals.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion Streamlit/results.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@

Training variance explained: 33.0%
Test variance explained: 32.0%
10 changes: 9 additions & 1 deletion Streamlit/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

# Load in the data
df = pd.read_csv("Streamlit/wine_quality.csv")
#connect to supabase with github secret keys

# Split into train and test sections
y = df.pop("quality")
Expand All @@ -32,10 +33,17 @@
test_score = regr.score(X_test, y_test) * 100

# Write scores to a file
#results was metrics
with open("Streamlit/results.txt", 'w') as outfile:
outfile.write("Training variance explained: %2.1f%%\n" % train_score)
outfile.write("Test variance explained: %2.1f%%\n" % test_score)
print("Successfully wrote to results.txt")
except Exception as e:
print(f"Failed to write to results.txt: {e}")

with open("Streamlit/results.txt", 'r') as outfile:
contents = outfile.read()
print("Contents of results.txt:")
print(contents)


##########################################
Expand Down
Loading