Update ML Parameter Coverage Documentation #6
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: Update ML Parameter Coverage Documentation | |
| on: | |
| # Trigger when search data is updated | |
| push: | |
| paths: | |
| - 'src/surfaces/search_data/**' | |
| - 'collect_ml_search_data.py' | |
| - 'generate_parameter_coverage_docs.py' | |
| # Allow manual triggering | |
| workflow_dispatch: | |
| # Run weekly to check for updates | |
| schedule: | |
| - cron: '0 6 * * 1' # Every Monday at 6 AM UTC | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| update-docs: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt || echo "No requirements.txt found" | |
| # Install package in development mode | |
| pip install -e . | |
| - name: Install additional ML dependencies | |
| run: | | |
| pip install scikit-learn numpy pandas | |
| - name: Check if search data exists | |
| id: check_data | |
| run: | | |
| if [ -d "src/surfaces/search_data" ] && [ "$(ls -A src/surfaces/search_data 2>/dev/null)" ]; then | |
| echo "data_exists=true" >> $GITHUB_OUTPUT | |
| echo "Found search data files:" | |
| ls -la src/surfaces/search_data/ | |
| else | |
| echo "data_exists=false" >> $GITHUB_OUTPUT | |
| echo "No search data found" | |
| fi | |
| - name: Generate parameter coverage documentation | |
| run: | | |
| echo "Generating ML parameter coverage documentation..." | |
| python generate_parameter_coverage_docs.py --output docs/ML_PARAMETER_COVERAGE.md | |
| # Also generate JSON data for potential API usage | |
| python generate_parameter_coverage_docs.py --json --output docs/ml_parameter_coverage.json | |
| echo "Documentation generated successfully" | |
| - name: Check for documentation changes | |
| id: check_changes | |
| run: | | |
| # Create docs directory if it doesn't exist | |
| mkdir -p docs | |
| # Check if files have changed | |
| git add docs/ML_PARAMETER_COVERAGE.md docs/ml_parameter_coverage.json 2>/dev/null || true | |
| if git diff --cached --quiet; then | |
| echo "changes_detected=false" >> $GITHUB_OUTPUT | |
| echo "No changes detected in documentation" | |
| else | |
| echo "changes_detected=true" >> $GITHUB_OUTPUT | |
| echo "Documentation changes detected" | |
| # Show what changed | |
| echo "Changes:" | |
| git diff --cached --name-only | |
| fi | |
| - name: Create Pull Request | |
| if: steps.check_changes.outputs.changes_detected == 'true' | |
| uses: peter-evans/create-pull-request@v5 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: | | |
| 📊 Update ML parameter coverage documentation | |
| Auto-generated documentation update showing current parameter | |
| coverage for machine learning test functions. | |
| - Updated ML_PARAMETER_COVERAGE.md with current database status | |
| - Updated ml_parameter_coverage.json with raw data | |
| 🤖 Generated with GitHub Actions | |
| title: "📊 Update ML Parameter Coverage Documentation" | |
| body: | | |
| ## 📊 ML Parameter Coverage Documentation Update | |
| This PR contains automatically generated updates to the machine learning parameter coverage documentation. | |
| ### What's Updated | |
| - `docs/ML_PARAMETER_COVERAGE.md` - Human-readable documentation tables | |
| - `docs/ml_parameter_coverage.json` - Machine-readable JSON data | |
| ### Current Status | |
| ${{ steps.check_data.outputs.data_exists == 'true' && '✅ Search data databases found and analyzed' || '⚠️ No search data found - documentation shows default ranges only' }} | |
| ### How to Collect More Data | |
| To improve parameter coverage, run: | |
| ```bash | |
| # Install dependencies | |
| pip install -e . | |
| # Collect data for all ML functions | |
| python collect_ml_search_data.py --all | |
| # Or collect for specific functions | |
| python collect_ml_search_data.py k_neighbors_classifier | |
| python collect_ml_search_data.py k_neighbors_regressor | |
| python collect_ml_search_data.py gradient_boosting_regressor | |
| ``` | |
| ### Manual Trigger | |
| This workflow can also be triggered manually from the Actions tab if you want to update documentation after collecting new data. | |
| --- | |
| 🤖 **Auto-generated by GitHub Actions** • [View workflow](../actions/workflows/update-ml-parameter-docs.yml) | |
| branch: update-ml-docs | |
| delete-branch: true | |
| draft: false | |
| labels: | | |
| documentation | |
| automated | |
| ml-functions | |
| - name: Summary | |
| run: | | |
| echo "## Workflow Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ "${{ steps.check_data.outputs.data_exists }}" == "true" ]; then | |
| echo "✅ **Search data found**: Documentation generated from existing databases" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "⚠️ **No search data found**: Documentation shows default parameter ranges only" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ "${{ steps.check_changes.outputs.changes_detected }}" == "true" ]; then | |
| echo "📄 **Documentation updated**: A pull request has been created with the latest parameter coverage information" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "📄 **No changes**: Documentation is already up to date" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Files Generated" >> $GITHUB_STEP_SUMMARY | |
| echo "- \`docs/ML_PARAMETER_COVERAGE.md\` - User-friendly documentation" >> $GITHUB_STEP_SUMMARY | |
| echo "- \`docs/ml_parameter_coverage.json\` - Machine-readable data" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Next Steps" >> $GITHUB_STEP_SUMMARY | |
| echo "1. Review the generated pull request if changes were detected" >> $GITHUB_STEP_SUMMARY | |
| echo "2. To collect more data, run \`python collect_ml_search_data.py --all\`" >> $GITHUB_STEP_SUMMARY | |
| echo "3. Commit any new search data to trigger automatic documentation updates" >> $GITHUB_STEP_SUMMARY |