Skip to content

Commit

Permalink
Merge pull request #10 from tryolabs/cd-train-step
Browse files Browse the repository at this point in the history
Add training step before deploying the API
  • Loading branch information
aguscas authored Jun 27, 2024
2 parents 8a6d973 + 9bd324c commit b3a97bc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Install dependencies for testing
- name: Install dependencies
run: |
pip install -r requirements-test.txt
pip install -r requirements.txt -r requirements-dev.txt -r requirements-test.txt
- name: Train Model
run: |
export PYTHONPATH=$PYTHONPATH:$(pwd)
python3 ./challenge/train.py
- name: Set up Cloud SDK
uses: google-github-actions/[email protected]
Expand Down
22 changes: 22 additions & 0 deletions challenge/train.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import argparse

import pandas as pd

from challenge.model import DelayModel

if __name__ == "__main__":

parser = argparse.ArgumentParser(description="Train a delay prediction model.")
parser.add_argument(
"--data",
type=str,
default="./data/data.csv",
help="Path to the csv dataset that will be used for training and testing",
)

args = parser.parse_args()
model = DelayModel()
data = pd.read_csv(filepath_or_buffer=args.data)

features, target = model.preprocess(data=data, target_column="delay")
model.fit(features=features, target=target)

0 comments on commit b3a97bc

Please sign in to comment.