Fix XGBRFClassifier multi-class ONNX conversion (wrong class assignment with num_parallel_tree > 1) #250
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: "CI" | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| run: | |
| name: ${{ matrix.os }} py==${{ matrix.python_version }} - sklearn${{ matrix.sklearn_version }} - ${{ matrix.onnxrt_version }} - xgboost${{ matrix.xgboost_version }} - lightgbm${{ matrix.lgbm_version }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python_version: ['3.13', '3.12', '3.11', '3.10'] | |
| include: | |
| - python_version: '3.13' | |
| documentation: 1 | |
| numpy_version: '>=2' | |
| scipy_version: '>=1.7.0' | |
| onnx_version: 'onnx>=1.18.0' | |
| onnxrt_version: 'onnxruntime>=1.22.0' | |
| sklearn_version: '>=1.8.0' | |
| lgbm_version: ">=4" | |
| xgboost_version: ">=2" | |
| - python_version: '3.12' | |
| documentation: 1 | |
| numpy_version: '>=1.21.1' | |
| scipy_version: '>=1.7.0' | |
| onnx_version: 'onnx==1.18.0' | |
| onnxrt_version: 'onnxruntime==1.20.1' | |
| sklearn_version: '==1.7.0' | |
| lgbm_version: ">=4" | |
| xgboost_version: ">=2" | |
| - python_version: '3.11' | |
| documentation: 0 | |
| numpy_version: '<2' | |
| scipy_version: '>=1.7.0' | |
| onnx_version: 'onnx<1.16.0' | |
| onnxrt_version: 'onnxruntime==1.17.3' | |
| sklearn_version: '==1.6.0' | |
| lgbm_version: ">=4" | |
| xgboost_version: ">=2" | |
| - python_version: '3.10' | |
| documentation: 0 | |
| numpy_version: '>=1.21.1,<2' | |
| scipy_version: '>=1.7.0' | |
| onnx_version: 'onnx==1.14.1' | |
| onnxrt_version: 'onnxruntime==1.16.3' | |
| sklearn_version: '==1.4.2' | |
| lgbm_version: "<4" | |
| xgboost_version: "<2" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python_version }} | |
| - name: Install requirements | |
| run: python -m pip install -r requirements.txt | |
| - name: Install requirements dev | |
| run: python -m pip install -r requirements-dev.txt | |
| - name: Cache pip | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| ${{ runner.os }}- | |
| - name: Install specific versions | |
| run: pip install "${{ matrix.onnx_version }}" "${{ matrix.onnxrt_version }}" "numpy${{ matrix.numpy_version }}" "scikit-learn${{ matrix.sklearn_version}}" "scipy${{ matrix.scipy_version }}" "xgboost${{ matrix.xgboost_version }}" | |
| - name: Install lightgbm | |
| if: matrix.os != 'macos-latest' | |
| run: pip install "lightgbm${{ matrix.lgbm_version }}" | |
| - name: Install | |
| run: pip install -e . | |
| - name: versions | |
| run: | | |
| python -c "from numpy import __version__;print('numpy', __version__)" | |
| python -c "from pandas import __version__;print('pandas', __version__)" | |
| python -c "from scipy import __version__;print('scipy', __version__)" | |
| python -c "from sklearn import __version__;print('sklearn', __version__)" | |
| python -c "from onnxruntime import __version__;print('onnxruntime', __version__)" | |
| python -c "from onnx import __version__;print('onnx', __version__)" | |
| python -c "import onnx.defs;print('onnx_opset_version', onnx.defs.onnx_opset_version())" | |
| - name: versions lightgbm, xgboost, catboost | |
| if: matrix.os != 'macos-latest' | |
| run: | | |
| python -c "from lightgbm import __version__;print('lightgbm', __version__)" | |
| python -c "from xgboost import __version__;print('xgboost', __version__)" | |
| python -c "from catboost import __version__;print('catboost', __version__)" | |
| - name: Run tests baseline | |
| run: pytest --maxfail=10 --durations=10 tests/baseline | |
| - name: Run tests utils | |
| run: pytest --maxfail=10 --durations=10 tests/utils | |
| - name: Run tests catboost | |
| run: pytest --maxfail=10 --durations=10 tests/catboost | |
| - name: Run tests lightgbm | |
| if: matrix.os != 'macos-latest' | |
| run: pytest --maxfail=10 --durations=10 tests/lightgbm | |
| - name: Run tests xgboost | |
| if: matrix.os != 'macos-latest' | |
| run: pytest --maxfail=10 --durations=10 tests/xgboost | |
| - name: Run tests svmlib | |
| run: pytest --maxfail=10 --durations=10 tests/svmlib | |
| - name: Run tests h2o | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| pip install h2o | |
| pytest --maxfail=10 --durations=10 tests/h2o | |
| - name: Run tests hummingbirdml | |
| if: ${{ matrix.os == 'ubuntu-latest' && matrix.xgboost_version != '<2' }} | |
| run: | | |
| pip install torch --extra-index-url https://download.pytorch.org/whl/cpu | |
| pip install hummingbird-ml --no-deps | |
| pytest --maxfail=10 --durations=10 tests/hummingbirdml | |
| - name: Run tests baseline | |
| run: pytest --maxfail=10 --durations=10 tests/baseline | |
| - name: Run tests pysparkml | |
| if: matrix.os == 'ubuntu-latest' && matrix.python_version != '3.12' | |
| run: pytest --maxfail=10 --durations=10 tests/sparkml | |
| - name: Install build dependencies | |
| run: pip install build | |
| - name: build | |
| run: python -m build . | |
| - uses: actions/upload-artifact@v6 | |
| with: | |
| name: artifact-${{ matrix.python_version }}-${{ matrix.os }} | |
| path: ./dist/** |