shap-rs 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- shap_rs-0.1.0/.github/workflows/bench.yml +51 -0
- shap_rs-0.1.0/.github/workflows/tests.yml +102 -0
- shap_rs-0.1.0/.github/workflows/wheels.yml +96 -0
- shap_rs-0.1.0/.gitignore +13 -0
- shap_rs-0.1.0/Cargo.lock +280 -0
- shap_rs-0.1.0/Cargo.toml +19 -0
- shap_rs-0.1.0/LICENSE +24 -0
- shap_rs-0.1.0/PKG-INFO +149 -0
- shap_rs-0.1.0/README.md +120 -0
- shap_rs-0.1.0/benchmarks/bench.py +52 -0
- shap_rs-0.1.0/ci/requirements.txt +15 -0
- shap_rs-0.1.0/docs/USAGE.md +92 -0
- shap_rs-0.1.0/examples/smoke.py +32 -0
- shap_rs-0.1.0/fuzz/README.md +14 -0
- shap_rs-0.1.0/fuzz/check.py +84 -0
- shap_rs-0.1.0/fuzz/fuzzlib.py +244 -0
- shap_rs-0.1.0/fuzz/gen.py +25 -0
- shap_rs-0.1.0/pyproject.toml +40 -0
- shap_rs-0.1.0/python/shap_rs/__init__.py +11 -0
- shap_rs-0.1.0/python/shap_rs/_kernel.py +237 -0
- shap_rs-0.1.0/python/shap_rs/_kexplain.py +301 -0
- shap_rs-0.1.0/python/shap_rs/_patch.py +149 -0
- shap_rs-0.1.0/python/shap_rs/_tree.py +471 -0
- shap_rs-0.1.0/src/fast.rs +519 -0
- shap_rs-0.1.0/src/fast_indep.rs +295 -0
- shap_rs-0.1.0/src/fast_indep_tf.rs +289 -0
- shap_rs-0.1.0/src/fast_inter.rs +296 -0
- shap_rs-0.1.0/src/indep.rs +409 -0
- shap_rs-0.1.0/src/kernel.rs +1427 -0
- shap_rs-0.1.0/src/lasso.rs +639 -0
- shap_rs-0.1.0/src/lib.rs +381 -0
- shap_rs-0.1.0/src/tree.rs +480 -0
- shap_rs-0.1.0/tests/conftest.py +164 -0
- shap_rs-0.1.0/tests/test_kernel.py +285 -0
- shap_rs-0.1.0/tests/test_patch.py +40 -0
- shap_rs-0.1.0/tests/test_tree.py +125 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Speed check on clean GitHub runners: real shap 0.54.1 vs shap_rs (benchmarks/bench.py, which also checks
|
|
2
|
+
# the max abs diff). Runs all cores, then shap_rs single-threaded (RAYON_NUM_THREADS=1).
|
|
3
|
+
name: bench
|
|
4
|
+
on:
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
jobs:
|
|
7
|
+
bench:
|
|
8
|
+
strategy:
|
|
9
|
+
fail-fast: false
|
|
10
|
+
matrix:
|
|
11
|
+
os: [ubuntu-latest, macos-latest]
|
|
12
|
+
runs-on: ${{ matrix.os }}
|
|
13
|
+
timeout-minutes: 90
|
|
14
|
+
defaults:
|
|
15
|
+
run:
|
|
16
|
+
shell: bash
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
- uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.12"
|
|
22
|
+
- if: runner.os == 'macOS'
|
|
23
|
+
run: brew install libomp
|
|
24
|
+
- name: machine
|
|
25
|
+
run: |
|
|
26
|
+
python -c "import os, platform; print(platform.platform(), platform.machine(), 'cpus:', os.cpu_count())"
|
|
27
|
+
(lscpu 2>/dev/null | grep -E "Model name|^CPU\(s\)") || sysctl -n machdep.cpu.brand_string
|
|
28
|
+
- name: install pinned deps + real shap
|
|
29
|
+
run: |
|
|
30
|
+
python -m pip install -q --upgrade pip
|
|
31
|
+
python -m pip install -q -r ci/requirements.txt shap==0.54.1 maturin==1.16.0
|
|
32
|
+
- name: build shap_rs from source
|
|
33
|
+
run: |
|
|
34
|
+
maturin build --release -o wheels
|
|
35
|
+
python -m pip install -q wheels/*.whl
|
|
36
|
+
- name: bench, all cores
|
|
37
|
+
working-directory: benchmarks
|
|
38
|
+
run: |
|
|
39
|
+
python -u bench.py | tee bench-all.log
|
|
40
|
+
cp bench.json bench-all-cores.json
|
|
41
|
+
- name: bench, shap_rs single thread
|
|
42
|
+
working-directory: benchmarks
|
|
43
|
+
env:
|
|
44
|
+
RAYON_NUM_THREADS: "1"
|
|
45
|
+
run: |
|
|
46
|
+
python -u bench.py | tee bench-1t.log
|
|
47
|
+
cp bench.json bench-1-thread.json
|
|
48
|
+
- uses: actions/upload-artifact@v4
|
|
49
|
+
with:
|
|
50
|
+
name: bench-${{ matrix.os }}
|
|
51
|
+
path: benchmarks/bench-*.json
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Exact-match checks against REAL shap 0.54.1.
|
|
2
|
+
# - pytest: in-repo differential tests (shap vs shap_rs in the same process). Runs on every push and PR.
|
|
3
|
+
# - fuzz (manual): make a ~2,000-case answer key with real shap on each OS, then replay it with shap_rs.patch()
|
|
4
|
+
# active (cheat guard on). Pass = every case matches and unpatch() restores shap.
|
|
5
|
+
name: tests
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [main]
|
|
9
|
+
pull_request:
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
inputs:
|
|
12
|
+
fuzz:
|
|
13
|
+
description: "Also run the full fuzz answer-key check (slow)"
|
|
14
|
+
type: boolean
|
|
15
|
+
default: false
|
|
16
|
+
jobs:
|
|
17
|
+
pytest:
|
|
18
|
+
strategy:
|
|
19
|
+
fail-fast: false
|
|
20
|
+
matrix:
|
|
21
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
22
|
+
python: ["3.12", "3.13"]
|
|
23
|
+
runs-on: ${{ matrix.os }}
|
|
24
|
+
timeout-minutes: 60
|
|
25
|
+
defaults:
|
|
26
|
+
run:
|
|
27
|
+
shell: bash
|
|
28
|
+
env:
|
|
29
|
+
PYTHONUTF8: "1"
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v4
|
|
32
|
+
- uses: actions/setup-python@v5
|
|
33
|
+
with:
|
|
34
|
+
python-version: ${{ matrix.python }}
|
|
35
|
+
- if: runner.os == 'macOS'
|
|
36
|
+
run: brew install libomp
|
|
37
|
+
- name: install pinned deps + real shap
|
|
38
|
+
run: |
|
|
39
|
+
python -m pip install -q --upgrade pip
|
|
40
|
+
python -m pip install -q -r ci/requirements.txt shap==0.54.1 maturin==1.16.0 pytest catboost
|
|
41
|
+
- name: build shap_rs from source
|
|
42
|
+
run: |
|
|
43
|
+
maturin build --release -o wheels
|
|
44
|
+
python -m pip install -q wheels/*.whl
|
|
45
|
+
- name: pytest (live compare vs real shap)
|
|
46
|
+
run: python -m pytest -q -p no:cacheprovider tests
|
|
47
|
+
fuzz:
|
|
48
|
+
if: github.event_name == 'workflow_dispatch' && inputs.fuzz
|
|
49
|
+
strategy:
|
|
50
|
+
fail-fast: false
|
|
51
|
+
matrix:
|
|
52
|
+
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
|
|
53
|
+
python: ["3.12"]
|
|
54
|
+
runs-on: ${{ matrix.os }}
|
|
55
|
+
timeout-minutes: 150
|
|
56
|
+
defaults:
|
|
57
|
+
run:
|
|
58
|
+
shell: bash
|
|
59
|
+
env:
|
|
60
|
+
PYTHONUTF8: "1"
|
|
61
|
+
SHAP_FUZZ_CASES: ${{ github.workspace }}/cases-ci
|
|
62
|
+
steps:
|
|
63
|
+
- uses: actions/checkout@v4
|
|
64
|
+
- uses: actions/setup-python@v5
|
|
65
|
+
with:
|
|
66
|
+
python-version: ${{ matrix.python }}
|
|
67
|
+
- if: runner.os == 'macOS'
|
|
68
|
+
run: brew install libomp
|
|
69
|
+
- name: install pinned deps + real shap
|
|
70
|
+
run: |
|
|
71
|
+
python -m pip install -q --upgrade pip
|
|
72
|
+
python -m pip install -q -r ci/requirements.txt shap==0.54.1 maturin==1.16.0
|
|
73
|
+
- name: build shap_rs from source
|
|
74
|
+
run: |
|
|
75
|
+
maturin build --release -o wheels
|
|
76
|
+
python -m pip install -q wheels/*.whl
|
|
77
|
+
- name: answer key with real shap (4 parallel shards)
|
|
78
|
+
working-directory: fuzz
|
|
79
|
+
run: |
|
|
80
|
+
mkdir -p "$SHAP_FUZZ_CASES"
|
|
81
|
+
for r in "0 525" "525 1050" "1050 1575" "1575 2100"; do
|
|
82
|
+
python -u gen.py $r > "gen-${r// /-}.log" 2>&1 &
|
|
83
|
+
done
|
|
84
|
+
wait
|
|
85
|
+
echo "cases: $(ls "$SHAP_FUZZ_CASES" | wc -l) skip: $(cat gen-*.log | grep -c SKIP) err: $(cat gen-*.log | grep -c ' ERR ')"
|
|
86
|
+
- name: replay with shap_rs patched
|
|
87
|
+
working-directory: fuzz
|
|
88
|
+
run: |
|
|
89
|
+
python -u check.py | tee check.log
|
|
90
|
+
grep -q "unpatch restores shap.TreeExplainer: True" check.log
|
|
91
|
+
python - <<'EOF'
|
|
92
|
+
import re, sys
|
|
93
|
+
m = re.search(r"PASS (\d+)/(\d+)", open("check.log").read())
|
|
94
|
+
sys.exit(0 if m and m.group(1) == m.group(2) and int(m.group(2)) > 2000 else 1)
|
|
95
|
+
EOF
|
|
96
|
+
- if: always()
|
|
97
|
+
uses: actions/upload-artifact@v4
|
|
98
|
+
with:
|
|
99
|
+
name: fuzz-logs-${{ matrix.os }}
|
|
100
|
+
path: |
|
|
101
|
+
fuzz/*.log
|
|
102
|
+
fuzz/results-*.json
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Build wheels (Linux x86_64/aarch64, macOS arm64/x86_64, Windows x64; CPython 3.12 and 3.13) + sdist,
|
|
2
|
+
# smoke-test each wheel against real shap, then publish to PyPI.
|
|
3
|
+
# Publishing happens only on a v* tag, or on a manual run with publish=true.
|
|
4
|
+
name: wheels
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
tags: ["v*"]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
inputs:
|
|
10
|
+
publish:
|
|
11
|
+
description: "Upload to PyPI after the smoke tests pass"
|
|
12
|
+
type: boolean
|
|
13
|
+
default: false
|
|
14
|
+
jobs:
|
|
15
|
+
build:
|
|
16
|
+
strategy:
|
|
17
|
+
fail-fast: false
|
|
18
|
+
matrix:
|
|
19
|
+
include:
|
|
20
|
+
- { os: ubuntu-latest, target: x86_64, manylinux: "2_28" }
|
|
21
|
+
- { os: ubuntu-latest, target: aarch64, manylinux: "2_28" }
|
|
22
|
+
- { os: macos-latest, target: aarch64-apple-darwin }
|
|
23
|
+
- { os: macos-15-intel, target: x86_64-apple-darwin }
|
|
24
|
+
- { os: windows-latest, target: x64 }
|
|
25
|
+
runs-on: ${{ matrix.os }}
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v4
|
|
28
|
+
- uses: actions/setup-python@v5
|
|
29
|
+
with:
|
|
30
|
+
python-version: |
|
|
31
|
+
3.12
|
|
32
|
+
3.13
|
|
33
|
+
- uses: PyO3/maturin-action@v1
|
|
34
|
+
with:
|
|
35
|
+
target: ${{ matrix.target }}
|
|
36
|
+
manylinux: ${{ matrix.manylinux || 'auto' }}
|
|
37
|
+
args: --release --out dist -i python3.12 python3.13
|
|
38
|
+
- uses: actions/upload-artifact@v4
|
|
39
|
+
with:
|
|
40
|
+
name: wheels-${{ matrix.os }}-${{ matrix.target }}
|
|
41
|
+
path: dist
|
|
42
|
+
sdist:
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
steps:
|
|
45
|
+
- uses: actions/checkout@v4
|
|
46
|
+
- uses: PyO3/maturin-action@v1
|
|
47
|
+
with:
|
|
48
|
+
command: sdist
|
|
49
|
+
args: --out dist
|
|
50
|
+
- uses: actions/upload-artifact@v4
|
|
51
|
+
with:
|
|
52
|
+
name: wheels-sdist
|
|
53
|
+
path: dist
|
|
54
|
+
smoke:
|
|
55
|
+
needs: build
|
|
56
|
+
strategy:
|
|
57
|
+
fail-fast: false
|
|
58
|
+
matrix:
|
|
59
|
+
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, macos-15-intel, windows-latest]
|
|
60
|
+
python: ["3.12", "3.13"]
|
|
61
|
+
runs-on: ${{ matrix.os }}
|
|
62
|
+
defaults:
|
|
63
|
+
run:
|
|
64
|
+
shell: bash
|
|
65
|
+
steps:
|
|
66
|
+
- uses: actions/checkout@v4
|
|
67
|
+
- uses: actions/setup-python@v5
|
|
68
|
+
with:
|
|
69
|
+
python-version: ${{ matrix.python }}
|
|
70
|
+
- uses: actions/download-artifact@v4
|
|
71
|
+
with:
|
|
72
|
+
pattern: wheels-*
|
|
73
|
+
merge-multiple: true
|
|
74
|
+
path: dist
|
|
75
|
+
- name: install wheel from dist only (no source build)
|
|
76
|
+
run: |
|
|
77
|
+
python -m pip install -q scikit-learn
|
|
78
|
+
python -m pip install -q --only-binary shap-rs --find-links dist shap-rs
|
|
79
|
+
python -m pip show shap-rs shap | grep -E "Name|Version"
|
|
80
|
+
- name: smoke
|
|
81
|
+
run: python examples/smoke.py
|
|
82
|
+
publish:
|
|
83
|
+
needs: [smoke, sdist]
|
|
84
|
+
if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && inputs.publish)
|
|
85
|
+
runs-on: ubuntu-latest
|
|
86
|
+
environment: pypi
|
|
87
|
+
steps:
|
|
88
|
+
- uses: actions/download-artifact@v4
|
|
89
|
+
with:
|
|
90
|
+
pattern: wheels-*
|
|
91
|
+
merge-multiple: true
|
|
92
|
+
path: dist
|
|
93
|
+
- run: ls -l dist
|
|
94
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
95
|
+
with:
|
|
96
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
shap_rs-0.1.0/.gitignore
ADDED
shap_rs-0.1.0/Cargo.lock
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "autocfg"
|
|
7
|
+
version = "1.5.1"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "crossbeam-deque"
|
|
13
|
+
version = "0.8.8"
|
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
+
checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a"
|
|
16
|
+
dependencies = [
|
|
17
|
+
"crossbeam-epoch",
|
|
18
|
+
"crossbeam-utils",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[[package]]
|
|
22
|
+
name = "crossbeam-epoch"
|
|
23
|
+
version = "0.9.21"
|
|
24
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
25
|
+
checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d"
|
|
26
|
+
dependencies = [
|
|
27
|
+
"crossbeam-utils",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[[package]]
|
|
31
|
+
name = "crossbeam-utils"
|
|
32
|
+
version = "0.8.23"
|
|
33
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
34
|
+
checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6"
|
|
35
|
+
|
|
36
|
+
[[package]]
|
|
37
|
+
name = "either"
|
|
38
|
+
version = "1.19.0"
|
|
39
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
40
|
+
checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
|
|
41
|
+
|
|
42
|
+
[[package]]
|
|
43
|
+
name = "heck"
|
|
44
|
+
version = "0.5.0"
|
|
45
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
46
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
47
|
+
|
|
48
|
+
[[package]]
|
|
49
|
+
name = "libc"
|
|
50
|
+
version = "0.2.191"
|
|
51
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
52
|
+
checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
|
|
53
|
+
|
|
54
|
+
[[package]]
|
|
55
|
+
name = "matrixmultiply"
|
|
56
|
+
version = "0.3.11"
|
|
57
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
58
|
+
checksum = "3f607c237553f086e7043417a51df26b2eb899d3caff94e6a67592ff992fedc7"
|
|
59
|
+
dependencies = [
|
|
60
|
+
"autocfg",
|
|
61
|
+
"rawpointer",
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
[[package]]
|
|
65
|
+
name = "ndarray"
|
|
66
|
+
version = "0.17.2"
|
|
67
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
68
|
+
checksum = "520080814a7a6b4a6e9070823bb24b4531daac8c4627e08ba5de8c5ef2f2752d"
|
|
69
|
+
dependencies = [
|
|
70
|
+
"matrixmultiply",
|
|
71
|
+
"num-complex",
|
|
72
|
+
"num-integer",
|
|
73
|
+
"num-traits",
|
|
74
|
+
"portable-atomic",
|
|
75
|
+
"portable-atomic-util",
|
|
76
|
+
"rawpointer",
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
[[package]]
|
|
80
|
+
name = "num-complex"
|
|
81
|
+
version = "0.4.6"
|
|
82
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
83
|
+
checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
|
|
84
|
+
dependencies = [
|
|
85
|
+
"num-traits",
|
|
86
|
+
]
|
|
87
|
+
|
|
88
|
+
[[package]]
|
|
89
|
+
name = "num-integer"
|
|
90
|
+
version = "0.1.47"
|
|
91
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
92
|
+
checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b"
|
|
93
|
+
dependencies = [
|
|
94
|
+
"num-traits",
|
|
95
|
+
]
|
|
96
|
+
|
|
97
|
+
[[package]]
|
|
98
|
+
name = "num-traits"
|
|
99
|
+
version = "0.2.19"
|
|
100
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
101
|
+
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
|
102
|
+
dependencies = [
|
|
103
|
+
"autocfg",
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
[[package]]
|
|
107
|
+
name = "numpy"
|
|
108
|
+
version = "0.30.0"
|
|
109
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
110
|
+
checksum = "aa0b9111761885449e894981fa8051dcf69e0bd114aecbd4bcdd830b6be4ed92"
|
|
111
|
+
dependencies = [
|
|
112
|
+
"libc",
|
|
113
|
+
"ndarray",
|
|
114
|
+
"num-complex",
|
|
115
|
+
"num-integer",
|
|
116
|
+
"num-traits",
|
|
117
|
+
"pyo3",
|
|
118
|
+
"pyo3-build-config",
|
|
119
|
+
"rustc-hash",
|
|
120
|
+
]
|
|
121
|
+
|
|
122
|
+
[[package]]
|
|
123
|
+
name = "once_cell"
|
|
124
|
+
version = "1.21.4"
|
|
125
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
126
|
+
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
127
|
+
|
|
128
|
+
[[package]]
|
|
129
|
+
name = "portable-atomic"
|
|
130
|
+
version = "1.15.0"
|
|
131
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
132
|
+
checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
|
|
133
|
+
|
|
134
|
+
[[package]]
|
|
135
|
+
name = "portable-atomic-util"
|
|
136
|
+
version = "0.2.8"
|
|
137
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
138
|
+
checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715"
|
|
139
|
+
dependencies = [
|
|
140
|
+
"portable-atomic",
|
|
141
|
+
]
|
|
142
|
+
|
|
143
|
+
[[package]]
|
|
144
|
+
name = "proc-macro2"
|
|
145
|
+
version = "1.0.107"
|
|
146
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
147
|
+
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
|
148
|
+
dependencies = [
|
|
149
|
+
"unicode-ident",
|
|
150
|
+
]
|
|
151
|
+
|
|
152
|
+
[[package]]
|
|
153
|
+
name = "pyo3"
|
|
154
|
+
version = "0.30.1"
|
|
155
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
156
|
+
checksum = "229ca13b8a15bb0d1487b81ab975bfcd97513416499a8312011b6036e42e0de4"
|
|
157
|
+
dependencies = [
|
|
158
|
+
"libc",
|
|
159
|
+
"once_cell",
|
|
160
|
+
"portable-atomic",
|
|
161
|
+
"pyo3-build-config",
|
|
162
|
+
"pyo3-ffi",
|
|
163
|
+
"pyo3-macros",
|
|
164
|
+
]
|
|
165
|
+
|
|
166
|
+
[[package]]
|
|
167
|
+
name = "pyo3-build-config"
|
|
168
|
+
version = "0.30.1"
|
|
169
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
170
|
+
checksum = "70130e2b6dd1ee589a8788026a429561ca5c40fa7a2fa7914c2282eddae24700"
|
|
171
|
+
dependencies = [
|
|
172
|
+
"target-lexicon",
|
|
173
|
+
]
|
|
174
|
+
|
|
175
|
+
[[package]]
|
|
176
|
+
name = "pyo3-ffi"
|
|
177
|
+
version = "0.30.1"
|
|
178
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
179
|
+
checksum = "5e7ff73c555c286d212d4ce7e5fbda845a973c4f61bd5f160f5f2c3c2a04d1c4"
|
|
180
|
+
dependencies = [
|
|
181
|
+
"libc",
|
|
182
|
+
"pyo3-build-config",
|
|
183
|
+
]
|
|
184
|
+
|
|
185
|
+
[[package]]
|
|
186
|
+
name = "pyo3-macros"
|
|
187
|
+
version = "0.30.1"
|
|
188
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
189
|
+
checksum = "c46d2e5862c7bb8207e3b639f713dda3c499933444784154c11d013c5a691b60"
|
|
190
|
+
dependencies = [
|
|
191
|
+
"proc-macro2",
|
|
192
|
+
"pyo3-macros-backend",
|
|
193
|
+
"quote",
|
|
194
|
+
"syn",
|
|
195
|
+
]
|
|
196
|
+
|
|
197
|
+
[[package]]
|
|
198
|
+
name = "pyo3-macros-backend"
|
|
199
|
+
version = "0.30.1"
|
|
200
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
201
|
+
checksum = "38b89f066f2ae72a2aef52d1537ca2fcd104440ebfadee06e97aa90738a25b9b"
|
|
202
|
+
dependencies = [
|
|
203
|
+
"heck",
|
|
204
|
+
"proc-macro2",
|
|
205
|
+
"quote",
|
|
206
|
+
"syn",
|
|
207
|
+
]
|
|
208
|
+
|
|
209
|
+
[[package]]
|
|
210
|
+
name = "quote"
|
|
211
|
+
version = "1.0.47"
|
|
212
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
213
|
+
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
|
214
|
+
dependencies = [
|
|
215
|
+
"proc-macro2",
|
|
216
|
+
]
|
|
217
|
+
|
|
218
|
+
[[package]]
|
|
219
|
+
name = "rawpointer"
|
|
220
|
+
version = "0.2.1"
|
|
221
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
222
|
+
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
|
|
223
|
+
|
|
224
|
+
[[package]]
|
|
225
|
+
name = "rayon"
|
|
226
|
+
version = "1.12.0"
|
|
227
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
228
|
+
checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d"
|
|
229
|
+
dependencies = [
|
|
230
|
+
"either",
|
|
231
|
+
"rayon-core",
|
|
232
|
+
]
|
|
233
|
+
|
|
234
|
+
[[package]]
|
|
235
|
+
name = "rayon-core"
|
|
236
|
+
version = "1.13.0"
|
|
237
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
238
|
+
checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
|
|
239
|
+
dependencies = [
|
|
240
|
+
"crossbeam-deque",
|
|
241
|
+
"crossbeam-utils",
|
|
242
|
+
]
|
|
243
|
+
|
|
244
|
+
[[package]]
|
|
245
|
+
name = "rustc-hash"
|
|
246
|
+
version = "2.1.3"
|
|
247
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
248
|
+
checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
|
|
249
|
+
|
|
250
|
+
[[package]]
|
|
251
|
+
name = "shap_rs"
|
|
252
|
+
version = "0.1.0"
|
|
253
|
+
dependencies = [
|
|
254
|
+
"numpy",
|
|
255
|
+
"pyo3",
|
|
256
|
+
"rayon",
|
|
257
|
+
]
|
|
258
|
+
|
|
259
|
+
[[package]]
|
|
260
|
+
name = "syn"
|
|
261
|
+
version = "3.0.10"
|
|
262
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
263
|
+
checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79"
|
|
264
|
+
dependencies = [
|
|
265
|
+
"proc-macro2",
|
|
266
|
+
"quote",
|
|
267
|
+
"unicode-ident",
|
|
268
|
+
]
|
|
269
|
+
|
|
270
|
+
[[package]]
|
|
271
|
+
name = "target-lexicon"
|
|
272
|
+
version = "0.13.5"
|
|
273
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
274
|
+
checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
|
|
275
|
+
|
|
276
|
+
[[package]]
|
|
277
|
+
name = "unicode-ident"
|
|
278
|
+
version = "1.0.27"
|
|
279
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
280
|
+
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
|
shap_rs-0.1.0/Cargo.toml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "shap_rs"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
|
|
7
|
+
[lib]
|
|
8
|
+
name = "_core"
|
|
9
|
+
crate-type = ["cdylib"]
|
|
10
|
+
|
|
11
|
+
[dependencies]
|
|
12
|
+
pyo3 = { version = "0.30", features = ["extension-module"] }
|
|
13
|
+
numpy = "0.30"
|
|
14
|
+
rayon = "1.12"
|
|
15
|
+
|
|
16
|
+
[profile.release]
|
|
17
|
+
opt-level = 3
|
|
18
|
+
lto = "fat"
|
|
19
|
+
codegen-units = 1
|
shap_rs-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Atomic Labs LLC
|
|
4
|
+
|
|
5
|
+
Portions are ports of SHAP (https://github.com/shap/shap), Copyright (c) 2018 Scott Lundberg,
|
|
6
|
+
also released under the MIT License.
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
in the Software without restriction, including without limitation the rights
|
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
SOFTWARE.
|