Skip to content

Commit

Permalink
Merge pull request #1 from BlairCurrey/gh-actions-train-setup
Browse files Browse the repository at this point in the history
feat: initial train gh action
  • Loading branch information
BlairCurrey authored Feb 5, 2024
2 parents 2cccfa0 + 9a35b80 commit 18c2482
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 2 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/train-spread-predictor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: NFL Analytics Pipeline

on:
# schedule:
# - cron: '0 0 * * 2'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12

# TODO: install in virtual env? https://python-poetry.org/docs/#ci-recommendations
# TODO: pin version? https://python-poetry.org/docs/#ci-recommendations
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
source $HOME/.poetry/env
poetry --version
- name: Install dependencies with Poetry
run: poetry install

- name: Run Python script
run: poetry run python main.py --download --train

# TODO: tag name? release name?
- name: Create release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: ./nfl_analytics/assets/*
env:
# TODO: what do i need to do for this? probably generate something on gh?
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload model, scaler, and running average dataframe
id: upload_assets
uses: actions/upload-artifact@v4
with:
name: assets
path: ./nfl_analytics/assets/*

- name: Attach assets to release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ needs.upload_assets.outputs.artifact_paths }}
asset_name: assets
asset_content_type: application/zip
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,13 @@ score differential is wrong? look at first game. the number for the 2 teams dont
- [x] predict spread
- [ ] github workflow
- [ ] periodically train the model (and release model, scaler, running_avg_dfall w/ same timestamp)
- [ ] add save functionality to --train flag that saves the running_avg_df to assets
- [ ] update predict fn to only predict from this saved df. should ensure its always using latest data that model was trained with (instead of using new data model wasnt trained with when building from csv).
- [x] add save functionality to --train flag that saves the running_avg_df to assets
- [x] update predict fn to only predict from this saved df. should ensure its always using latest data that model was trained with (instead of using new data model wasnt trained with when building from csv).
- [ ] periodically get upcoming games and make predictions. publish on github pages. get booky spread too?
- [ ] Github actions cleanup
- [ ] output model mean absolute error to md file and use as body of release (with any other info). have some release template.
- [ ] maybe release should use timestamp?
- [ ] (maybe) if there are any hardcoded paths (like asset dir?), think about how to not hardcode them.
- Quality of Life Improvements
- [ ] add cli doc generator. look into `argparse.HelpFormatter` to generate a markdown file.
- [ ] add types
Expand Down

0 comments on commit 18c2482

Please sign in to comment.