-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from tryolabs/cd-train-step
Add training step before deploying the API
- Loading branch information
Showing
2 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |