Skip to main content

wlearn-rf Python

Python estimator wrapper for the wlearn C11 random forest core.

Install

pip install wlearn-rf

Example

from wlearn_rf import RFModel

model = RFModel({"n_estimators": 100, "seed": 42})
model.fit(X, y)
pred = model.predict(X_test)
proba = model.predict_proba(X_test)

model.save("rf.wlrn")
restored = RFModel.load("rf.wlrn")

API

  • RFModel(params=None).
  • fit(X, y) trains a classifier by default; set task: "regression" for regression.
  • predict(X), predict_proba(X), score(X, y).
  • predict_quantile(X, quantile) and predict_interval(X, alpha) for regression forests.
  • feature_importances(), permutation_importance(...), proximity(X), oob_score() inspect fitted forests.
  • save(path=None) returns WLRN bytes and writes them when given a str or Path.
  • RFModel.load(bytes_or_path) accepts WLRN bytes, str, or Path.
  • get_params() / set_params(...) support estimator cloning/search.
  • default_search_space(task=None) returns the AutoML search-space IR.
  • dispose() releases native memory early in long-running processes.

Properties: n_features, n_classes, n_trees, is_fitted, capabilities.

Common params: n_estimators, max_depth, min_samples_split, min_samples_leaf, max_features, bootstrap, compute_oob, extra_trees, seed, task, criterion, sample_weight, class_weight, sample_rate, histogram_binning, max_bins, monotonic_cst.

save() returns a WLRN bundle. RF01 native bytes are an internal artifact inside the bundle, matching JavaScript @wlearn/rf.

Development

The canonical native source is repository root src/; py/csrc/ is generated for Python builds. Use WLEARN_PYTHON=/path/to/python make test-py from the repository root to force a specific Python environment.

Classification accepts int32 labels, including negative and nonconsecutive values. The classes property gives the probability-column order. Artifacts with a nonidentity label mapping use wlearn.rf.classifier@2; ordinal classifiers and regressors retain their existing @1 format. Both formats load in this release.

Metadata

Release files for wlearn-rf 0.4.1

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

Source distribution (sdist)

Source distribution for wlearn-rf 0.4.1
File Size Uploaded Provenance Actions
wlearn_rf-0.4.1.tar.gz 42.9 kB Without provenance Details for wlearn_rf-0.4.1.tar.gz

Release files / wlearn_rf-0.4.1.tar.gz

Download URL wlearn_rf-0.4.1.tar.gz
Size 42.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6eb076cea7c71e2f2088526bdd05bf2550df8f4ff2f200e1cdf41ebd6319f25b
BLAKE2b-256 checksum
How to use checksums
14c5a55f73cb4c7ccbedd3ad2c28d811249e0f1d3a7f301740a8f19d5be120d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Security for wlearn-rf 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4.1 This release

1 release file No provenance

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