prfr
Probabilistic random forest regressor: random forest model that accounts for errors in predictors and labels, yields calibrated probabilistic predictions, and corrects for bias.
For a faster and more elaborate calibration routine (highly recommended), a JAX installation is required. You can install the package with the extra jax feature, which will install the necessary dependencies.
Installation
From PyPI, with jax feature:
pip install "prfr[jax]"
From PyPI, without jax feature:
pip install prfr
From Github (latest), with jax feature:
pip install "prfr[jax] @ git+https://github.com/al-jshen/prfr"
From Github (latest), without jax feature:
pip install "git+https://github.com/al-jshen/prfr"
Example usage
import numpy as np
import prfr
x_obs = np.random.uniform(0., 10., size=10000).reshape(-1, 1)
x_err = np.random.exponential(1., size=10000).reshape(-1, 1)
y_obs = np.random.normal(x_obs, x_err).reshape(-1, 1) * 2. + 1.
y_err = np.ones_like(y_obs)
train, test, valid = prfr.split_arrays(x_obs, y_obs, x_err, y_err, test_size=0.2, valid_size=0.2)
model = prfr.ProbabilisticRandomForestRegressor(n_estimators=250, n_jobs=-1)
model.fit(train[0], train[1], eX=train[2], eY=train[3])
model.fit_bias(valid[0], valid[1], eX=valid[2])
# check whether the calibration routine will run with JAX
print(prfr.has_jax)
model.calibrate(valid[0], valid[1], eX=valid[2])
pred = model.predict(test[0], eX=test[2])
pred_qtls = np.quantile(pred, [0.16, 0.5, 0.84], axis=-1)
print(pred.shape)
Metadata
Release files for prfr 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| prfr-0.2.4.tar.gz | 14.0 kB | Without provenance | Details for prfr-0.2.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| prfr-0.2.4-py3-none-any.whl | Python 3 | none | any | Details for prfr-0.2.4-py3-none-any.whl |
Total release size: 27.7 kB
Release files / prfr-0.2.4.tar.gz
| Download URL | prfr-0.2.4.tar.gz |
|---|---|
| Size | 14.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
406bdb6c52bafde4c3f02104def34c02254fcd6b56d0577454bb280b6da87c91
|
|
BLAKE2b-256 checksum How to use checksums |
a386b60b88aa53afe24575b5b29f47f306cde861d7f6a98ba8bd3807865ac254
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.10.4 Darwin/22.2.0
|
Release files / prfr-0.2.4-py3-none-any.whl
| Download URL | prfr-0.2.4-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
31ef629509d63d84fb8a763aab981c64e9e14d4ce49ca093ee7dbb0b064f6923
|
|
BLAKE2b-256 checksum How to use checksums |
6859580b808ea2cb6db6c81b2bcc06109e31e401bacc1067d2719ea4991dc840
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.10.4 Darwin/22.2.0
|
Security for prfr 0.2.4
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.