name: Predictive Maintenance ML Pipeline on: push: branches: [ main ] pull_request: branches: [ main ] workflow_dispatch: env: PYTHON_VERSION: '3.11' HF_USERNAME: 'SharleyK' DATASET_NAME: 'PredictiveMaintenance' MODEL_NAME: 'engine-predictive-maintenance' MLFLOW_TRACKING_URI: 'file:./mlruns' jobs: data-registration: name: Data Registration runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4 with: python-version: 3.11 - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt - name: Create project folders run: | python scripts/01_create_folders.py - name: Register data to Hugging Face env: HF_TOKEN: ${ secrets.HF_TOKEN } run: | python scripts/02_register_data.py - name: Verify data registration env: HF_TOKEN: ${ secrets.HF_TOKEN } run: | python scripts/03_verify_data.py exploratory-analysis: name: Exploratory Data Analysis runs-on: ubuntu-latest needs: data-registration steps: - name: Checkout repository uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4 with: python-version: 3.11 - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt - name: Run EDA analysis env: HF_TOKEN: ${ secrets.HF_TOKEN } run: | python scripts/05_run_eda.py data-preparation: name: Data Preparation runs-on: ubuntu-latest needs: exploratory-analysis steps: - name: Checkout repository uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4 with: python-version: 3.11 - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt - name: Clean and prepare data env: HF_TOKEN: ${ secrets.HF_TOKEN } run: | python scripts/07_clean_data.py python scripts/09_train_test_split.py python scripts/10_upload_processed_data.py model-training: name: Model Training & Experimentation runs-on: ubuntu-latest needs: data-preparation steps: - name: Checkout repository uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4 with: python-version: 3.11 - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt - name: Train all models env: HF_TOKEN: ${ secrets.HF_TOKEN } run: | python scripts/13_train_decision_tree.py python scripts/14_train_bagging.py python scripts/15_train_random_forest.py python scripts/16_train_adaboost.py python scripts/17_train_gradient_boosting.py python scripts/18_train_xgboost.py - name: Compare and register best model env: HF_TOKEN: ${ secrets.HF_TOKEN } run: | python scripts/19_compare_models.py python scripts/20_register_best_model.py