-
Notifications
You must be signed in to change notification settings - Fork 235
67 lines (52 loc) · 2.07 KB
/
github_lab2_model_calibration.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Periodic Model Calibration - Ghithub Lab 2
on:
schedule:
- cron: '0 0 * * *'
jobs:
retrain:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: pip install -r Labs/Github_Labs/Lab2/requirements.txt
- name: Generate and Store Timestamp
run: |
timestamp=$(date '+%Y%m%d%H%M%S')
echo "$timestamp" > timestamp.txt
id: timestamp
- name: Check File Permissions
run: |
ls -l Labs/Github_Labs/Lab2/src/train_model.py
- name: Set File Permissions
run: |
chmod +x Labs/Github_Labs/Lab2/src/train_model.py
- name: Retrain Model
run: |
timestamp=$(cat timestamp.txt) # Use the timestamp in your training script
python Labs/Github_Labs/Lab2/src/train_model.py --timestamp "$timestamp"
- name: Evaluate Model and Log Metrics
run: |
timestamp=$(cat timestamp.txt) # Use the timestamp in your training script
python Labs/Github_Labs/Lab2/src/evaluate_model.py --timestamp "$timestamp" # Assuming you have a script for model evaluation
metrics_filename="${timestamp}_metrics.json"
mv $metrics_filename Labs/Github_Labs/Lab2/metrics/$metrics_filename
continue-on-error: false # Continue even if evaluation fails
- name: Store and Version the New Model
run: |
timestamp=$(cat timestamp.txt)
model_filename="model_${timestamp}_dt_model.joblib"
mv $model_filename Labs/Github_Labs/Lab2/models/$model_filename
- name: Commit and Push Changes
run: |
git config --global user.email "[email protected]"
git config --global user.name "raminmohammadi"
git add Labs/Github_Labs/Lab2/metrics/$metrics_filename Labs/Github_Labs/Lab2/models/$model_filename
git commit -m "Add metrics and updated model"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}