Repository navigation
update module 27 solution #2
This file contains hidden or 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
| name: Fairness Check | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - content | |
| paths: | |
| - "module-27-fairlearn/**" | |
| jobs: | |
| train: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: module-27-fairlearn/solution | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: pip-fairlearn-${{ hashFiles('module-27-fairlearn/solution/requirements.txt') }} | |
| # TODO: Install dependencies from requirements.txt | |
| - name: Install dependencies | |
| run: pip install -r requirements.txt | |
| # TODO: Train the model and save the model + test data artifacts | |
| - name: Train model | |
| run: python train.py | |
| # TODO: Upload the model and test data so the check-fairness job can use them | |
| - name: Upload model artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: model-artifacts | |
| path: | | |
| module-27-fairlearn/solution/model.joblib | |
| module-27-fairlearn/solution/X_test.npy | |
| module-27-fairlearn/solution/y_test.npy | |
| module-27-fairlearn/solution/sf_test.csv | |
| check-fairness: | |
| runs-on: ubuntu-latest | |
| needs: train | |
| defaults: | |
| run: | |
| working-directory: module-27-fairlearn/solution | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: pip-fairlearn-${{ hashFiles('module-27-fairlearn/solution/requirements.txt') }} | |
| # TODO: Install dependencies from requirements.txt | |
| - name: Install dependencies | |
| run: pip install -r requirements.txt | |
| # TODO: Download the model and test data artifacts from the train job | |
| - name: Download model artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: model-artifacts | |
| path: module-27-fairlearn/solution | |
| # TODO: Run the fairness gate against the model artifacts | |
| - name: Run fairness gate | |
| run: python check_fairness.py | |
| # TODO: Upload fairness_report.json as a downloadable artifact (even on failure) | |
| - name: Upload fairness report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: fairness-report | |
| path: module-27-fairlearn/solution/fairness_report.json |