No project description provided
Project description
prfr
Probabilistic random forest regressor: random forest model that accounts for errors in predictors and labels, yields calibrated probabilistic predictions, and corrects for bias.
Installation
pip install prfr
OR
pip install git+https://github.com/al-jshen/prfr
Example usage
import numpy as np
from prfr import ProbabilisticRandomForestRegressor, split_arrays
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 = split_arrays(x_obs, y_obs, x_err, y_err, test_size=0.2, valid_size=0.2)
model = 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])
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
prfr-0.1.11.tar.gz
(12.3 kB
view details)
Built Distribution
prfr-0.1.11-py3-none-any.whl
(12.2 kB
view details)
File details
Details for the file prfr-0.1.11.tar.gz
.
File metadata
- Download URL: prfr-0.1.11.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.10.4 Darwin/21.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79d2bced5d26d4cf6c25b33d24c402cd3eed373740f19baad776380df78efc79 |
|
MD5 | 02adcc94b7ef76625f4154f640a5e2c3 |
|
BLAKE2b-256 | 081543de38f953c02d17b1353a49ed166caf29fc96277e28ee2158dcee870bfb |
File details
Details for the file prfr-0.1.11-py3-none-any.whl
.
File metadata
- Download URL: prfr-0.1.11-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.10.4 Darwin/21.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df2ce6b21ed72dd098716383f0b9ddeab3d41b1fff3a3d4e1c347ef7049b149d |
|
MD5 | babc6ca7c77d40b96cd9e909e3fd68b8 |
|
BLAKE2b-256 | 4d85e00e8b88ba414fd61276eb07d0b71d5d003926504c85f2c046c23c27a131 |