Skip to content

Commit

Permalink
Ci Exp
Browse files Browse the repository at this point in the history
  • Loading branch information
arpitpatel1 committed Jan 1, 2024
1 parent 0ba244f commit f2dc4b6
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 5 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# .github/workflows/ci_cd.yml

name: CI Pipeline

on:
push:

jobs:
build:
runs-on: ubuntu-latest

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ap-south-1

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.11
- uses: iterative/setup-cml@v2

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run data_loader file
run: |
python src/data/data_loader.py

- name: Create CML report
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
model_score=$(cat artifacts/score.txt)
echo "# Model Score Report" >> report.md
echo "The R2 score is: $model_score" >> report.md
cml comment create report.md
2 changes: 1 addition & 1 deletion artifacts/score.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.8519963391434942
0.8488143131332259
Binary file modified models/model.pkl
Binary file not shown.
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ bs4
path
category_encoders
dvclive
boto3
botocore

6 changes: 2 additions & 4 deletions src/data/data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def read_data_from_s3(s3_bucket, s3_key):

# Read the CSV into a DataFrame
df = pd.read_csv(s3_response['Body'])
print(df.shape)

return df

Expand All @@ -81,7 +80,6 @@ def read_data_from_s3(s3_bucket, s3_key):
s3_key = 'data/interim/properties_post_feature_selection_v2.csv'

df = read_data_from_s3(s3_bucket, s3_key)
print(df.shape)


# df.drop(columns=['servant room', 'study room', 'others'], inplace=True)
Expand Down Expand Up @@ -111,8 +109,8 @@ def read_data_from_s3(s3_bucket, s3_key):

modeltrainer = ModelTrainer()
score = modeltrainer.initiate_model_trainer(train_arr,test_arr)
with Live(save_dvc_exp=True) as live:
live.log_metric('R2 score',score)
# with Live(save_dvc_exp=True) as live:
# live.log_metric('R2 score',score)

artifacts_dir = Path.cwd() / 'artifacts'
artifacts_dir.mkdir(parents=True, exist_ok=True)
Expand Down

2 comments on commit f2dc4b6

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Model Score Report

The R2 score is: 0.8481847667395972

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Model Score Report

The R2 score is: 0.843364500938008

Please sign in to comment.