Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Bankai Boruta

Native Rust implementation of the Boruta all-relevant feature selection algorithm with a scikit-learn compatible Python API.

The canonical classification selector now runs its complete Boruta iteration loop inside Rust. BankaiBoruta.fit(X, y) accepts C- or F-contiguous NumPy float32/float64 arrays without copying X; incompatible numeric inputs can use input_mode="copy". Rejected features are pruned between iterations, confirmed features remain as context in canonical mode, and unresolved features stay tentative when max_iter is reached. pruning="aggressive" removes confirmed features from subsequent training and is experimental; use it only when the benchmarked trade-off is acceptable for your data. Deterministic multi-worker training is available with n_jobs. See docs/ROADMAP.md for details.

Development

Python wheels and editable installs use Maturin:

uv sync --extra test
uv run maturin develop --skip-install
uv run pytest

Rust core tests run with Cargo:

cargo test --workspace

Polars and Arrow input

Install bankai-boruta[polars] to select directly from Polars DataFrames. The strict path supports Float32/Float64 columns, mixed float widths, slices, and independently chunked columns. It imports each Series through Arrow C Stream, retaining the original value buffers for the duration of fit. No rechunk, NumPy conversion or augmented matrix is needed. Nulls, NaN/Inf, unsupported types and unaligned buffers raise an error. Integers can use the explicit input_mode="copy" conversion path.

from bankai_boruta import BankaiBoruta
from sklearn.pipeline import make_pipeline
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import cross_val_score

selector = BankaiBoruta(random_state=42, n_jobs=4)
pipeline = make_pipeline(selector, DecisionTreeClassifier(random_state=42))
scores = cross_val_score(pipeline, X_polars, y, cv=3)

Selection belongs inside the cross-validation pipeline. For a fitted selector, set_output(transform="polars") preserves named Polars output. transform may allocate its selected output. Pickle/joblib store decisions and metadata, not training buffers or forests; a failed refit clears the preceding fitted state.

Other CPU Arrow C Stream table exporters are accepted without copying buffers inside the importer. Their own export methods may allocate; the end-to-end zero-copy guarantee is tested specifically for supported Polars float layouts. copied_bytes measures known matrix materializations, not all allocations or allocations internal to third-party exporters. Labels, shadow indices, chunk metadata and forest workspaces still allocate. Keep inputs unchanged during fit. PyArrow is not a runtime dependency.

Optional scikit-learn estimator

The default BankaiBoruta() continues to use the native Rust forest and does not call Python inside the iteration loop. To use a scikit-learn estimator, pass a cloneable classifier that exposes feature_importances_:

from bankai_boruta import BankaiBoruta
from sklearn.ensemble import ExtraTreesClassifier

selector = BankaiBoruta(
    estimator=ExtraTreesClassifier(n_estimators=64, random_state=42),
    importance_getter="auto",
    random_state=42,
)
selector.fit(X, y)

Bankai still owns the Boruta controller, shadow generation, pruning and statistical decisions in Rust. The opt-in path clones and fits the Python estimator once per iteration on a C-contiguous matrix containing active real features followed by shadows. This requires a Python callback and materializes that augmented matrix on every iteration, so it trades speed and memory for model flexibility. diagnostics_["copied_bytes"] counts those matrix bytes; external_estimator_calls and external_estimator_seconds report callback count and time, while fit_time_seconds reports total selector fit time. The estimator template is not fitted or otherwise mutated. At present, importance_getter="auto" reads feature_importances_, falling back to coef_ and summing absolute coefficients across classes. A dotted attribute path or callable can supply custom scores. Getters must return one finite, non-negative score per augmented input column. The native mode remains the recommended default for performance and zero-copy input.

The Arrow development suite must run with its optional dependencies installed:

uv sync --extra test --extra arrow-test
uv run --no-sync maturin develop --release --skip-install
uv run --no-sync pytest

See the M6 plan and FFI ownership notes.

Metadata

Release files for bankai-boruta 0.1.0a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bankai-boruta 0.1.0a1
File Size Uploaded
bankai_boruta-0.1.0a1.tar.gz 52.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for bankai-boruta 0.1.0a1
File
bankai_boruta-0.1.0a1-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
bankai_boruta-0.1.0a1-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details
bankai_boruta-0.1.0a1-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details
bankai_boruta-0.1.0a1-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details
bankai_boruta-0.1.0a1-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details

Total release size: 2.6 MB

Release files / bankai_boruta-0.1.0a1.tar.gz

Download URL bankai_boruta-0.1.0a1.tar.gz
Size 52.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0541b82b99fb47c3da27ebdd3f89f40c7deb3c7e570918420d0262ad46f0a139
BLAKE2b-256 checksum
How to use checksums
9fa9dfdb900f1681ae415cd58ab0a445d1e097ed25f2b2532af62f3ce92f415e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / bankai_boruta-0.1.0a1-cp311-abi3-win_amd64.whl

Download URL bankai_boruta-0.1.0a1-cp311-abi3-win_amd64.whl
Size 440.1 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
ec8ed44ed5cbb67bfa2ab0d17c34bc615a769c81fbe35d197c88df49c4446f55
BLAKE2b-256 checksum
How to use checksums
3db91bc4bf9bde93457545d7692cfc503d6180173131f24382df2d2a346ae9bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / bankai_boruta-0.1.0a1-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL bankai_boruta-0.1.0a1-cp311-abi3-manylinux_2_28_x86_64.whl
Size 550.7 kB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
735ac82482e409f852bd16759e29f52ebe45fd1874b7b789cf9c62986a922848
BLAKE2b-256 checksum
How to use checksums
ae5f184973812cf6f7f754e32d8f042112b4e3481495a653c11146a598baf9ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / bankai_boruta-0.1.0a1-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL bankai_boruta-0.1.0a1-cp311-abi3-manylinux_2_28_aarch64.whl
Size 516.3 kB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
9125ba64bc3fa1017cde805a299d3f240c468b7ea12012153f53f0cb1555f2f8
BLAKE2b-256 checksum
How to use checksums
0aab9e6be0e7fab73cc027689d0857a6477009d8959a689b511f73689911146d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / bankai_boruta-0.1.0a1-cp311-abi3-macosx_11_0_arm64.whl

Download URL bankai_boruta-0.1.0a1-cp311-abi3-macosx_11_0_arm64.whl
Size 476.5 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ae17c0f0a412760d9d18488d7b7be8ce85814e1d321ba640495d998ad9e3c881
BLAKE2b-256 checksum
How to use checksums
91c394ceef4353efe2959506180a5451c412d2d8df5048fb93f9cc553777d57b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / bankai_boruta-0.1.0a1-cp311-abi3-macosx_10_12_x86_64.whl

Download URL bankai_boruta-0.1.0a1-cp311-abi3-macosx_10_12_x86_64.whl
Size 517.8 kB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
6f03b15bae881105694d379bba0bba586a3c4ddbecfc2e3ee7e6b4151956fd9b
BLAKE2b-256 checksum
How to use checksums
f39b9cca0567f2dcde2597002382244602f241ff5a4e2de47660ac36d5f7fe69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page